panic: assignment to entry in nil map

Syncthing was down on a computer that I help administer remotely, and upon checking it I’ve found these panic logs. Unfortunately, I don’t what could’ve happened exactly. The system itself was still working when I logged into it, and it hadn’t run out of disk space or memory or anything like that beforehand.

This is Windows 10 x64 and the Syncthing version was v1.20.2 (custom built).

Have you got any idea what this problem may be about?

Panic at 2022-07-31T10:24:39+09:00
panic: assignment to entry in nil map

goroutine 30 [running]:*deadlockDetector).watchInner(0xc00019cc00, {0x1a63b64, 0x4}, 0xc000fe3440) +0x22c*deadlockDetector).Watch.func1() +0x65
created by*deadlockDetector).Watch +0x115

goroutine 1 [chan receive, 118 minutes]:*App).Wait(...)
main.syncthingMain({{{0x1}, {0x0, 0x0}, {0xc00019f0c0, 0x39}, 0x0, 0x0}, 0x0, 0x0, {0x0, ...}, ...}) +0xd5e
main.serveOptions.Run({{{0x1}, {0x0, 0x0}, {0xc00019f0c0, 0x39}, 0x0, 0x0}, 0x0, 0x0, {0x0, ...}, ...}) +0x758{0x1a55880?, 0x23ba3a0?, 0x1898465?}, {0x1a63794, 0x4}, {0xc000147b90, 0x0, 0x1012308?})
	reflect/value.go:556 +0x845
reflect.Value.Call({0x1a55880?, 0x23ba3a0?, 0x195c4c0?}, {0xc000147b90, 0x0, 0x0})
	reflect/value.go:339 +0xbf{0x1a631b2, 0x3}, {0x1a55880?, 0x23ba3a0?, 0x3?}, {0x1a55880?, 0x23ba3a0?, 0x0?}, 0x0?) +0x4e7*Context).RunNode(0xc0000ab000, 0xc00009a2d0, {0x0, 0x0, 0x0}) +0x5f7*Context).Run(0x18f10a0?, {0x0?, 0x0?, 0x0?}) +0x14e
main.main() +0x3b6

That’s a bug. The deadlock detector has detected that it took a long time to acquire a lock and is going to report it, but crashes because a thing isn’t properly initialized. I’ll fix it.

Thank you for looking into it, and for a very quick fix too (as usual)! :slightly_smiling_face: