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

panic: nil pointer dereference because (*db.Lowlevel)getMetaAndCheck() returns nil #7005

Closed
tomasz1986 opened this issue Sep 25, 2020 · 2 comments · Fixed by #7150
Closed
Labels
bug A problem with current functionality, as opposed to missing functionality (enhancement) frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Milestone

Comments

@tomasz1986
Copy link
Contributor

tomasz1986 commented Sep 25, 2020

I have just noticed a panic log from ~1 week ago in my Syncthing home folder. I do not remember what might have caused the panic though, and Syncthing probably automatically recovered after that, so I had no idea until now. The operating system logs also do not show anything special taking place at that time.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0x104a217]

goroutine 56 [running]:
github.com/syncthing/syncthing/lib/db.(*metadataTracker).devices(0x0, 0x0, 0x0, 0x0)
	github.com/syncthing/syncthing/lib/db/meta.go:407 +0x47
github.com/syncthing/syncthing/lib/db.(*FileSet).ListDevices(...)
	github.com/syncthing/syncthing/lib/db/set.go:433
github.com/syncthing/syncthing/lib/model.(*model).addAndStartFolderLockedWithIgnores(0x129000d0, 0x12c01ca0, 0xb, 0x12c01cb8, 0x8, 0x0, 0x12c01cd0, 0xb, 0x2, 0x12a46a80, ...)
	github.com/syncthing/syncthing/lib/model/model.go:311 +0x1ee
github.com/syncthing/syncthing/lib/model.(*model).addAndStartFolderLocked(0x129000d0, 0x12c01ca0, 0xb, 0x12c01cb8, 0x8, 0x0, 0x12c01cd0, 0xb, 0x2, 0x12a46a80, ...)
	github.com/syncthing/syncthing/lib/model/model.go:286 +0x12e
github.com/syncthing/syncthing/lib/model.(*model).newFolder(0x129000d0, 0x12c01ca0, 0xb, 0x12c01cb8, 0x8, 0x0, 0x12c01cd0, 0xb, 0x2, 0x12a46a80, ...)
	github.com/syncthing/syncthing/lib/model/model.go:515 +0x217
github.com/syncthing/syncthing/lib/model.(*model).onServe(0x129000d0)
	github.com/syncthing/syncthing/lib/model/model.go:252 +0x151
github.com/syncthing/syncthing/lib/model.(*model).Serve(0x129000d0)
	github.com/syncthing/syncthing/lib/model/model.go:235 +0x21
github.com/thejerf/suture.(*Supervisor).runService.func1(0x128d2460, 0x1, 0x334e6cc0, 0x129000d0)
	github.com/thejerf/suture@v3.0.2+incompatible/supervisor.go:600 +0x69
created by github.com/thejerf/suture.(*Supervisor).runService
	github.com/thejerf/suture@v3.0.2+incompatible/supervisor.go:588 +0x4b

Syncthing version was v1.10.0-rc.2.

@tomasz1986 tomasz1986 added bug A problem with current functionality, as opposed to missing functionality (enhancement) needs-triage New issues needed to be validated labels Sep 25, 2020
@tomasz1986 tomasz1986 changed the title invalid memory address or nil pointer dereference panic: runtime error: invalid memory address or nil pointer dereference Sep 25, 2020
@calmh calmh removed the needs-triage New issues needed to be validated label Sep 25, 2020
@calmh
Copy link
Member

calmh commented Sep 25, 2020

Yeah this can apparently happen because we can return a nil metadata object when there are database issues. Needs better error handling.

@calmh calmh changed the title panic: runtime error: invalid memory address or nil pointer dereference panic: nil pointer dereference because (*db.Lowlevel)getMetaAndCheck() returns nil Sep 25, 2020
@imsodin
Copy link
Member

imsodin commented Dec 24, 2020

Fixed by #7150

@imsodin imsodin closed this as completed Dec 24, 2020
@imsodin imsodin linked a pull request Dec 24, 2020 that will close this issue
@imsodin imsodin added this to the v1.13.0 milestone Dec 24, 2020
SimonPickup added a commit to MobiusSync/syncthing that referenced this issue Feb 9, 2021
v1.13.1

This release adds configuration options for min/max connections (see
https://docs.syncthing.net/advanced/option-connection-limits.html) and
moves the storage of pending devices/folders from the config to the
database (see
https://docs.syncthing.net/dev/rest.html#cluster-endpoints).

Bugfixes:

- syncthing#7005: panic: nil pointer dereference because (*db.Lowlevel)getMetaAndCheck() returns nil
- syncthing#7076: File not detected due to watching reporting events on old, deleted path
- syncthing#7165: Connections aren't actually closed when closing a protocol connection
- syncthing#7184: Spurious unexpected directory in untrusted folder
- syncthing#7197: In Recent Changes, the Device column is empty
- syncthing#7231: panic: deadlock detected at fmut

Enhancements:

- syncthing#7176: Active connections min/max setting
- syncthing#7178: Pending devices and folders should live in the database instead of configuration

Other issues:

- syncthing#6551: Test failure because of umask
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Dec 26, 2021
@syncthing syncthing locked and limited conversation to collaborators Dec 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug A problem with current functionality, as opposed to missing functionality (enhancement) frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants