Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid memory address or nil pointer dereference with start cmd, not happening with start-from-init #4330

Closed
CMiksche opened this issue Sep 6, 2022 · 1 comment · Fixed by #4333
Assignees
Labels
backend bug Something isn't working lang: go Pull requests that update Go code

Comments

@CMiksche
Copy link
Contributor

CMiksche commented Sep 6, 2022

Describe the bug
I run Zitadel with PostgreSQL. When I run the start command, I get the following error:

WARN[0000] postgres is currently in beta                 caller="/home/runner/work/zitadel/zitadel/internal/database/postgres/config.go:61"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9b595d]

goroutine 1 [running]:
github.com/sony/sonyflake.(*Sonyflake).NextID(0x0)
        /home/runner/go/pkg/mod/github.com/sony/sonyflake@v1.0.0/sonyflake.go:89 +0x3d
github.com/zitadel/zitadel/internal/id.(*sonyflakeGenerator).Next(0x451c89?)
        /home/runner/work/zitadel/zitadel/internal/id/sonyflake.go:26 +0x1c
github.com/zitadel/zitadel/internal/eventstore/handler/crdb.NewLocker(0xc000110f70, {0x1fc0695, 0x11}, {0x1fbe6ae, 0x10})
        /home/runner/work/zitadel/zitadel/internal/eventstore/handler/crdb/lock.go:39 +0x5f
github.com/zitadel/zitadel/internal/eventstore/handler/crdb.NewStatementHandler({_, _}, {{{0xc000278a80}, {0x1fbe6ae, 0x10}, 0xdf8475800, 0x3b9aca00, 0x5, 0x1}, 0xc000110f70, ...})
        /home/runner/work/zitadel/zitadel/internal/eventstore/handler/crdb/handler_stmt.go:75 +0x2ee
github.com/zitadel/zitadel/internal/query/projection.newOrgProjection({0x38d4b40, 0xc000124000}, {{{0xc000278a80}, {0x1fbe6ae, 0x10}, 0xdf8475800, 0x3b9aca00, 0x5, 0x1}, 0xc000110f70, ...})
        /home/runner/work/zitadel/zitadel/internal/query/projection/org.go:53 +0x9c8
github.com/zitadel/zitadel/internal/query/projection.Start({0x38d4b40, 0xc000124000}, 0xc000078400?, 0xc000881230?, {0xdf8475800, 0x3b9aca00, 0x5, 0x1, 0xc8, 0xc0007cb470, ...}, ...)
        /home/runner/work/zitadel/zitadel/internal/query/projection/projection.go:84 +0x22b
github.com/zitadel/zitadel/internal/query.StartQueries({0x38d4b40, 0xc000124000}, 0xc000278a80, 0xc000110f70, {0xdf8475800, 0x3b9aca00, 0x5, 0x1, 0xc8, 0xc0007cb470, ...}, ...)
        /home/runner/work/zitadel/zitadel/internal/query/query.go:82 +0x3d1
github.com/zitadel/zitadel/cmd/start.startZitadel(0xc0000ece00, {0x7fffc7302738, 0x20})
        /home/runner/work/zitadel/zitadel/cmd/start/start.go:103 +0x386
github.com/zitadel/zitadel/cmd/start.New.func1(0xc000204500?, {0x1fa4522?, 0x6?, 0x6?})
        /home/runner/work/zitadel/zitadel/cmd/start/start.go:72 +0x6a
github.com/spf13/cobra.(*Command).execute(0xc000204500, {0xc00055bec0, 0x6, 0x6})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002a8c80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
main.main()
        /home/runner/work/zitadel/zitadel/main.go:14 +0x74

If I use the start-from-init command instead, everything works.

To Reproduce
Steps to reproduce the behavior:

  1. Download the current Zitadel 2.3.4 version
  2. Setup with PostgreSQL
  3. Run zitadel start
  4. See error

Expected behavior
No error, same result like with start-from-init.

Additional context
I run version 2.3.4 on Ubuntu 20.04 LTS together with PostgreSQL 14.5 (Ubuntu 14.5-1.pgdg20.04+1)

My start command looks like the following:

zitadel start \
    --config /opt/zitadel/config.yaml \
    --masterkey HERE_IS_NY_KEY \
    --tlsMode external

The working start-from-init command uses the same parameters.

@CMiksche CMiksche added state: triage bug Something isn't working labels Sep 6, 2022
@adlerhurst adlerhurst linked a pull request Sep 6, 2022 that will close this issue
@adlerhurst adlerhurst self-assigned this Sep 6, 2022
@adlerhurst
Copy link
Member

hi @CMiksche thanks for your report. I attached a PR which will fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working lang: go Pull requests that update Go code
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants