[GH-ISSUE #1025] Segfault on publish (installed with nix) #719

Closed
opened 2026-05-05 04:15:08 -06:00 by gitea-mirror · 9 comments
Owner

Originally created by @antony-frolov on GitHub (Feb 14, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1025

🐞 Describe the bug

Got a segfault error when running publish command. Installed ntfy with nix on ubuntu 18.04.

💻 Components impacted

ntfy server

💡 Screenshots and/or logs

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

goroutine 1 [running]:
heckel.io/ntfy/v2/cmd.defaultClientConfigFileUnix()
	heckel.io/ntfy/v2/cmd/subscribe.go:324 +0x13
heckel.io/ntfy/v2/cmd.defaultClientConfigFile(...)
	heckel.io/ntfy/v2/cmd/subscribe_unix.go:17
heckel.io/ntfy/v2/cmd.loadConfig(0xc0006cb548?)
	heckel.io/ntfy/v2/cmd/subscribe.go:313 +0x30
heckel.io/ntfy/v2/cmd.execPublish(0xc0003eac40)
	heckel.io/ntfy/v2/cmd/publish.go:87 +0x2a
github.com/urfave/cli/v2.(*Command).Run(0x2f3f8e0, 0xc0003eac40, {0xc0003be450, 0x3, 0x3})
	github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x998
github.com/urfave/cli/v2.(*Command).Run(0xc000243600, 0xc0003ea680, {0xc0001d6000, 0x4, 0x4})
	github.com/urfave/cli/v2@v2.25.7/command.go:267 +0xbe5
github.com/urfave/cli/v2.(*App).RunContext(0xc0005da000, {0x290ff78?, 0x2fe5660}, {0xc0001d6000, 0x4, 0x4})
	github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x5b7
github.com/urfave/cli/v2.(*App).Run(...)
	github.com/urfave/cli/v2@v2.25.7/app.go:309
main.main()
	heckel.io/ntfy/v2/main.go:32 +0x31

🔮 Additional context

Originally created by @antony-frolov on GitHub (Feb 14, 2024). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1025 :lady_beetle: **Describe the bug** <!-- A clear and concise description of the problem. --> Got a segfault error when running publish command. Installed ntfy with nix on ubuntu 18.04. :computer: **Components impacted** <!-- ntfy server, Android app, iOS app, web app --> ntfy server :bulb: **Screenshots and/or logs** <!-- If applicable, add screenshots or share logs help explain your problem. To get logs from the ... - ntfy server: Enable "log-level: trace" in your server.yml file - Android app: Go to "Settings" -> "Record logs", then eventually "Copy/upload logs" - web app: Press "F12" and find the "Console" window --> ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc49c93] goroutine 1 [running]: heckel.io/ntfy/v2/cmd.defaultClientConfigFileUnix() heckel.io/ntfy/v2/cmd/subscribe.go:324 +0x13 heckel.io/ntfy/v2/cmd.defaultClientConfigFile(...) heckel.io/ntfy/v2/cmd/subscribe_unix.go:17 heckel.io/ntfy/v2/cmd.loadConfig(0xc0006cb548?) heckel.io/ntfy/v2/cmd/subscribe.go:313 +0x30 heckel.io/ntfy/v2/cmd.execPublish(0xc0003eac40) heckel.io/ntfy/v2/cmd/publish.go:87 +0x2a github.com/urfave/cli/v2.(*Command).Run(0x2f3f8e0, 0xc0003eac40, {0xc0003be450, 0x3, 0x3}) github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x998 github.com/urfave/cli/v2.(*Command).Run(0xc000243600, 0xc0003ea680, {0xc0001d6000, 0x4, 0x4}) github.com/urfave/cli/v2@v2.25.7/command.go:267 +0xbe5 github.com/urfave/cli/v2.(*App).RunContext(0xc0005da000, {0x290ff78?, 0x2fe5660}, {0xc0001d6000, 0x4, 0x4}) github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x5b7 github.com/urfave/cli/v2.(*App).Run(...) github.com/urfave/cli/v2@v2.25.7/app.go:309 main.main() heckel.io/ntfy/v2/main.go:32 +0x31 ``` :crystal_ball: **Additional context** <!-- Add any other context about the problem here. -->
gitea-mirror 2026-05-05 04:15:08 -06:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@pcouy commented on GitHub (Feb 23, 2024):

I am having the exact same issue with a docker compose setup. The program counter in the error message differs from the one above, but the call stack is the same.

I'm running ntfy 2.8.0 (aaa4976), runtime go1.21.3, built at 2023-11-19T21:51:43Z

<!-- gh-comment-id:1960895226 --> @pcouy commented on GitHub (Feb 23, 2024): I am having the exact same issue with a docker compose setup. The program counter in the error message differs from the one above, but the call stack is the same. I'm running `ntfy 2.8.0 (aaa4976), runtime go1.21.3, built at 2023-11-19T21:51:43Z`
Author
Owner

@binwiederhier commented on GitHub (Mar 7, 2024):

This is wild. The thing that's failing is the user.Current() call, which means that Go cannot determine the current Linux/Windows user. I added logging here ef302d22a9 so we can get an error message, and avoid a panic.

Once I release this (which should be shortly), you can give me more details on the error.

<!-- gh-comment-id:1984446241 --> @binwiederhier commented on GitHub (Mar 7, 2024): This is wild. The thing that's failing is the `user.Current()` call, which means that Go cannot determine the current Linux/Windows user. I added logging here https://github.com/binwiederhier/ntfy/commit/ef302d22a981b2fab8b47777b8ebf068507e5091 so we can get an error message, and avoid a panic. Once I release this (which should be shortly), you can give me more details on the error.
Author
Owner

@binwiederhier commented on GitHub (Mar 24, 2024):

Can you try again with the latest release and give me the error message?

<!-- gh-comment-id:2016895526 --> @binwiederhier commented on GitHub (Mar 24, 2024): Can you try again with the latest release and give me the error message?
Author
Owner

@antony-frolov commented on GitHub (Mar 24, 2024):

tried the same command with the latest release and it works fine! so the issue is solved for me i guess

<!-- gh-comment-id:2016896971 --> @antony-frolov commented on GitHub (Mar 24, 2024): tried the same command with the latest release and it works fine! so the issue is solved for me i guess
Author
Owner

@binwiederhier commented on GitHub (Mar 25, 2024):

Does it print a warning?

<!-- gh-comment-id:2018020089 --> @binwiederhier commented on GitHub (Mar 25, 2024): Does it print a warning?
Author
Owner

@antony-frolov commented on GitHub (Mar 25, 2024):

it does
2024/03/25 16:37:22 WARN Could not determine default client config file: could not determine current user: user: unknown userid 451693

<!-- gh-comment-id:2018027700 --> @antony-frolov commented on GitHub (Mar 25, 2024): it does `2024/03/25 16:37:22 WARN Could not determine default client config file: could not determine current user: user: unknown userid 451693`
Author
Owner

@binwiederhier commented on GitHub (Mar 25, 2024):

This fails: https://github.com/binwiederhier/ntfy/blob/main/cmd/subscribe.go#L328-L331

This is a Go standard library call to determine the current user. If this fails, something on your system regarding your current user is unusual or wrong. Check if id, cat /etc/passwd | grep $USER and echo $USER all add up.

<!-- gh-comment-id:2018062295 --> @binwiederhier commented on GitHub (Mar 25, 2024): This fails: https://github.com/binwiederhier/ntfy/blob/main/cmd/subscribe.go#L328-L331 This is a Go standard library call to determine the current user. If this fails, something on your system regarding your current user is unusual or wrong. Check if `id`, `cat /etc/passwd | grep $USER` and `echo $USER` all add up.
Author
Owner

@antony-frolov commented on GitHub (Mar 25, 2024):

there is indeed something unusual, user info on our VMs is stored not in /etc/passwd but in some database common for all VMs i guess. so i can only get my user info with getent passwd $USER

<!-- gh-comment-id:2018073493 --> @antony-frolov commented on GitHub (Mar 25, 2024): there is indeed something unusual, user info on our VMs is stored not in `/etc/passwd` but in some database common for all VMs i guess. so i can only get my user info with `getent passwd $USER`
Author
Owner

@binwiederhier commented on GitHub (Mar 25, 2024):

I would have thought that Go does that under the hood 🤷

<!-- gh-comment-id:2018556517 --> @binwiederhier commented on GitHub (Mar 25, 2024): I would have thought that Go does that under the hood :shrug:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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: github-starred/ntfy#719
No description provided.