Panic when deleting user now #984

Closed
opened 2021-09-17 03:06:18 +00:00 by W-Floyd · 7 comments

Using latest Docker image. Example:

$ sudo docker-compose run api /app/vikunja/vikunja user delete 4 -n
Creating docker_api_run ... done
2021/09/17 03:02:09 Config File "config" Not Found in "[/app/vikunja /etc/vikunja /root/.config/vikunja]"
2021/09/17 03:02:09 Using default config.
2021-09-17T03:02:09.934012265Z: INFO    ▶ migration/Migrate 048 Ran all migrations successfully.
You requested to delete the user immediately. Are you sure?
To confirm, please type "yes, I confirm" in all uppercase:
[...]
YES, I CONFIRM
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe0fbd7]

goroutine 1 [running]:
code.vikunja.io/api/pkg/user.(*User).GetName(...)
        /go/src/code.vikunja.io/api/pkg/user/user.go:144
code.vikunja.io/api/pkg/user.(*AccountDeletedNotification).ToMail(0xc00027a000, 0x7ff4200a2ec8)
        /go/src/code.vikunja.io/api/pkg/user/notifications.go:259 +0x57
code.vikunja.io/api/pkg/notifications.notifyMail(0x16a2b48, 0xc0000c2000, 0x16aab58, 0xc00027a000, 0x8, 0x1229240)
        /go/src/code.vikunja.io/api/pkg/notifications/notification.go:65 +0x35
code.vikunja.io/api/pkg/notifications.Notify(0x16a2b48, 0xc0000c2000, 0x16aab58, 0xc00027a000, 0x0, 0x0)
        /go/src/code.vikunja.io/api/pkg/notifications/notification.go:56 +0x133
code.vikunja.io/api/pkg/models.DeleteUser(0xc00033edd0, 0xc0000c2000, 0x1, 0xc0000c2000)
        /go/src/code.vikunja.io/api/pkg/models/user_delete.go:170 +0x87a
code.vikunja.io/api/pkg/cmd.glob..func24(0x1d445e0, 0xc00007e1e0, 0x1, 0x2)
        /go/src/code.vikunja.io/api/pkg/cmd/user.go:342 +0x18a
github.com/spf13/cobra.(*Command).execute(0x1d445e0, 0xc00007e1c0, 0x2, 0x2, 0x1d445e0, 0xc00007e1c0)
        /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x1d44d60, 0xc000000180, 0x200000003, 0xc000000180)
        /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
code.vikunja.io/api/pkg/cmd.Execute()
        /go/src/code.vikunja.io/api/pkg/cmd/cmd.go:44 +0x31
main.main()
        /go/src/code.vikunja.io/api/main.go:22 +0x25

Docker settings (scrubbed of personal info):

VIKUNJA_DATABASE_HOST: db
VIKUNJA_DATABASE_PASSWORD: secret
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: root
VIKUNJA_DATABASE_DATABASE: vikunja
VIKUNJA_JWTSECRET: secret
VIKUNJA_SERVICE_FRONTENDURL: 'https://myfrontend.com'
VIKUNJA_MAILER_ENABLED: 'true'
VIKUNJA_MAILER_HOST: 'example.mailer.com'
VIKUNJA_MAILER_USERNAME: 'username'
VIKUNJA_MAILER_PASSWORD: 'password'
VIKUNJA_MAILER_FROMEMAIL: 'example.sender@example.com'
Using latest Docker image. Example: ``` $ sudo docker-compose run api /app/vikunja/vikunja user delete 4 -n Creating docker_api_run ... done 2021/09/17 03:02:09 Config File "config" Not Found in "[/app/vikunja /etc/vikunja /root/.config/vikunja]" 2021/09/17 03:02:09 Using default config. 2021-09-17T03:02:09.934012265Z: INFO ▶ migration/Migrate 048 Ran all migrations successfully. You requested to delete the user immediately. Are you sure? To confirm, please type "yes, I confirm" in all uppercase: [...] YES, I CONFIRM panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe0fbd7] goroutine 1 [running]: code.vikunja.io/api/pkg/user.(*User).GetName(...) /go/src/code.vikunja.io/api/pkg/user/user.go:144 code.vikunja.io/api/pkg/user.(*AccountDeletedNotification).ToMail(0xc00027a000, 0x7ff4200a2ec8) /go/src/code.vikunja.io/api/pkg/user/notifications.go:259 +0x57 code.vikunja.io/api/pkg/notifications.notifyMail(0x16a2b48, 0xc0000c2000, 0x16aab58, 0xc00027a000, 0x8, 0x1229240) /go/src/code.vikunja.io/api/pkg/notifications/notification.go:65 +0x35 code.vikunja.io/api/pkg/notifications.Notify(0x16a2b48, 0xc0000c2000, 0x16aab58, 0xc00027a000, 0x0, 0x0) /go/src/code.vikunja.io/api/pkg/notifications/notification.go:56 +0x133 code.vikunja.io/api/pkg/models.DeleteUser(0xc00033edd0, 0xc0000c2000, 0x1, 0xc0000c2000) /go/src/code.vikunja.io/api/pkg/models/user_delete.go:170 +0x87a code.vikunja.io/api/pkg/cmd.glob..func24(0x1d445e0, 0xc00007e1e0, 0x1, 0x2) /go/src/code.vikunja.io/api/pkg/cmd/user.go:342 +0x18a github.com/spf13/cobra.(*Command).execute(0x1d445e0, 0xc00007e1c0, 0x2, 0x2, 0x1d445e0, 0xc00007e1c0) /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x2c2 github.com/spf13/cobra.(*Command).ExecuteC(0x1d44d60, 0xc000000180, 0x200000003, 0xc000000180) /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x375 github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902 code.vikunja.io/api/pkg/cmd.Execute() /go/src/code.vikunja.io/api/pkg/cmd/cmd.go:44 +0x31 main.main() /go/src/code.vikunja.io/api/main.go:22 +0x25 ``` Docker settings (scrubbed of personal info): ``` VIKUNJA_DATABASE_HOST: db VIKUNJA_DATABASE_PASSWORD: secret VIKUNJA_DATABASE_TYPE: mysql VIKUNJA_DATABASE_USER: root VIKUNJA_DATABASE_DATABASE: vikunja VIKUNJA_JWTSECRET: secret VIKUNJA_SERVICE_FRONTENDURL: 'https://myfrontend.com' VIKUNJA_MAILER_ENABLED: 'true' VIKUNJA_MAILER_HOST: 'example.mailer.com' VIKUNJA_MAILER_USERNAME: 'username' VIKUNJA_MAILER_PASSWORD: 'password' VIKUNJA_MAILER_FROMEMAIL: 'example.sender@example.com' ```
Author

Also fails to delete the user as scheduled. Web UI says:

We will delete your Vikunja account at Sep 19, 2021, 10:07:18 PM (about 14 hours ago)
Also fails to delete the user as scheduled. Web UI says: ``` We will delete your Vikunja account at Sep 19, 2021, 10:07:18 PM (about 14 hours ago) ```
Owner

That clearly looks like a bug. Will take a look.

That clearly looks like a bug. Will take a look.
konrad added the
kind/bug
label 2021-09-21 19:41:03 +00:00
Owner

Fixed in 50b65a517d - the CI is currently releasing a new unstable version, please test with that to see if it resolved the issue.

Fixed in https://kolaente.dev/vikunja/api/commit/50b65a517da6869dc6a48fec40323e254ba4c032 - the CI is currently releasing a new unstable version, please test with that to see if it resolved the issue.
Author

Sorry for the late reply! I suspect your change used to work, but there is a new error now at least:

$ sudo docker-compose run api /app/vikunja/vikunja user delete 4 -n
Creating docker_api_run ... done
2021/11/22 00:30:14 Config File "config" Not Found in "[/app/vikunja /etc/vikunja /root/.config/vikunja]"
2021/11/22 00:30:14 Using default config.
2021-11-22T00:30:14.420415057Z: INFO	▶ migration/Migrate 048 Ran all migrations successfully.
You requested to delete the user immediately. Are you sure?
To confirm, please type "yes, I confirm" in all uppercase:
[...]
YES, I CONFIRM
panic: interface conversion: interface {} is nil, not []*models.NamespaceWithLists

goroutine 1 [running]:
code.vikunja.io/api/pkg/models.DeleteUser(0xc0005ec000, 0xc0005be240, 0x1, 0xc0005be240)
	/go/src/code.vikunja.io/api/pkg/models/user_delete.go:95 +0x92e
code.vikunja.io/api/pkg/cmd.glob..func24(0x1d445e0, 0xc0004e0d60, 0x1, 0x2)
	/go/src/code.vikunja.io/api/pkg/cmd/user.go:342 +0x18a
github.com/spf13/cobra.(*Command).execute(0x1d445e0, 0xc0004e0d40, 0x2, 0x2, 0x1d445e0, 0xc0004e0d40)
	/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x1d44d60, 0xc000000180, 0x200000003, 0xc000000180)
	/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
code.vikunja.io/api/pkg/cmd.Execute()
	/go/src/code.vikunja.io/api/pkg/cmd/cmd.go:44 +0x31
main.main()
	/go/src/code.vikunja.io/api/main.go:22 +0x25
Sorry for the late reply! I suspect your change used to work, but there is a new error now at least: ``` $ sudo docker-compose run api /app/vikunja/vikunja user delete 4 -n Creating docker_api_run ... done 2021/11/22 00:30:14 Config File "config" Not Found in "[/app/vikunja /etc/vikunja /root/.config/vikunja]" 2021/11/22 00:30:14 Using default config. 2021-11-22T00:30:14.420415057Z: INFO ▶ migration/Migrate 048 Ran all migrations successfully. You requested to delete the user immediately. Are you sure? To confirm, please type "yes, I confirm" in all uppercase: [...] YES, I CONFIRM panic: interface conversion: interface {} is nil, not []*models.NamespaceWithLists goroutine 1 [running]: code.vikunja.io/api/pkg/models.DeleteUser(0xc0005ec000, 0xc0005be240, 0x1, 0xc0005be240) /go/src/code.vikunja.io/api/pkg/models/user_delete.go:95 +0x92e code.vikunja.io/api/pkg/cmd.glob..func24(0x1d445e0, 0xc0004e0d60, 0x1, 0x2) /go/src/code.vikunja.io/api/pkg/cmd/user.go:342 +0x18a github.com/spf13/cobra.(*Command).execute(0x1d445e0, 0xc0004e0d40, 0x2, 0x2, 0x1d445e0, 0xc0004e0d40) /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x2c2 github.com/spf13/cobra.(*Command).ExecuteC(0x1d44d60, 0xc000000180, 0x200000003, 0xc000000180) /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x375 github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902 code.vikunja.io/api/pkg/cmd.Execute() /go/src/code.vikunja.io/api/pkg/cmd/cmd.go:44 +0x31 main.main() /go/src/code.vikunja.io/api/main.go:22 +0x25 ```
W-Floyd reopened this issue 2021-11-22 00:32:55 +00:00
Author

Likely the same as #1021

Likely the same as #1021
Owner

It looks like that's caused by deleting a user who does not have any namespaces or lists. I've pushed a fix for that in f8a0a7e953, please try with the next unstable build once the CI released a new version.

It looks like that's caused by deleting a user who does not have any namespaces or lists. I've pushed a fix for that in https://kolaente.dev/vikunja/api/commit/f8a0a7e9539a44b2f790a08eb1b03028b56eaac3, please try with the next unstable build once the CI released a new version.
konrad reopened this issue 2021-11-22 21:35:15 +00:00
Author

Tested latest unstable, fixed now. Thanks!

Tested latest unstable, fixed now. Thanks!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#984
No description provided.