Skip to content

imap-acct (and creds) CLI crashes with nil pointer when storage modules aren’t started #815

@paschembri

Description

@paschembri

Describe the bug

maddy imap-acct (and related CLI commands) panic because the CLI loads the config but doesn’t call Start() on LifetimeModule.

For storage.imapsql, this leaves Back nil, and EnableUpdatePipe() dereferences a nil UpdateManager, causing a SIGSEGV.

The server path starts modules correctly, but the CLI does not.

Steps to reproduce

  1. Run maddy in Docker with a config that includes storage.imapsql local_mailboxes.
  2. Execute:
    docker exec -it maddy-local maddy imap-acct create alice@example.test

Log files

Panic stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xeb5430]

goroutine 1 [running]:
github.com/foxcpp/go-imap-sql.(*Backend).UpdateManager(...)
        github.com/foxcpp/go-imap-sql@v0.5.1-0.20250124140007-8da5567429d5/backend.go:343
github.com/foxcpp/maddy/internal/storage/imapsql.(*Storage).EnableUpdatePipe(...)
        internal/storage/imapsql/imapsql.go:348
github.com/foxcpp/maddy/internal/cli/ctl.openStorage(...)
        internal/cli/ctl/moduleinit.go:96
...

Configuration file

(attach or paste sanitized file)

  • Based on Docker config (maddy.conf.docker)
  • Uses storage.imapsql local_mailboxes with sqlite3 dsn
storage.imapsql local_mailboxes {
    driver sqlite3
    dsn imapsql.db
}

Environment information

  • maddy v0.9.0 / b1dc3ff
  • Docker / MacOS / Arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions