henrygd / beszel

Lightweight server monitoring hub with historical data, docker stats, and alerts.
MIT License
1.58k stars 58 forks source link

[BUG] Runtime error when trying to save notification URL #216

Open Stitch10925 opened 1 day ago

Stitch10925 commented 1 day ago

Hi,

Every time I try to add a notification URL the Beszel container crashes with the following error:

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

 goroutine 103 [running]:
 github.com/pocketbase/pocketbase/models.(*Record).Set(0xc00016d880, {0x162bdbc, 0x6}, {0x14020c0, 0xc0007a8e20})
    /go/pkg/mod/github.com/pocketbase/pocketbase@v0.22.22/models/record.go:305 +0x209
 beszel/internal/hub.(*Hub).updateSystem(0xc00010ae10, 0xc000603960)
    /app/internal/hub/hub.go:310 +0x83b
 created by beszel/internal/hub.(*Hub).updateSystems in goroutine 13
    /app/internal/hub/hub.go:252 +0x170

The URL I'm trying to save has the following format: ntfy://user:passw@hostname/topic

Also, sometimes when I refresh the browser it doesn't show me my systems anymore, but I guess that is another problem since no errors are logged for that.


PS: THANK YOU (!) for this project. I have been looking for a long time for a simple monitoring tool with centralized management for alerts. This tool is just perfect.

henrygd commented 1 day ago

No worries.

Can you please go to the Export Collections page (/_/#/settings/export-collections), copy your collections, and paste them here?

Or download the JSON file and attach it.

Stitch10925 commented 1 day ago

Here is the export:

collections_export.json

henrygd commented 1 day ago

Are you sure this is triggered when trying to save notification settings, or could the timing be coincidence?

The trace is not directly related to that. I was able to replicate the error by changing the name of the container_stats collection, which is why I wanted to double check your collection schema. But that looks fine.

This is also the first I've heard of systems sometimes not showing up.

Regardless, I'll refactor that section of code for the next release to prevent the panic from happening.

Can you let me know if you see any errors in the browser devtools console besides "ClientResponseError 0: The request was autocancelled"? That one is expected and harmless.

Stitch10925 commented 23 hours ago

While I was trying to get the collection export for you I had a lot of crashes in Beszel. I also noticed that other services I had running on Docker were unstable. Tonight I had another look at it. I shut down some of the services and everything became stable again.

I assume that my NAS (which hosts the NFS volumes for my Docker services) isn't able to provide fast enough I/O for the Docker services. This is probably also why Beszel is behaving a bit odd. I am going to replace some of the disks in my NAS with SSDs to see if that fixes the issue.

henrygd commented 21 hours ago

Sounds good.

The specific error you ran into should be impossible now in 0.6.2, but let me know if any other weirdness continues.