keybase / client

Keybase Go Library, Client, Service, OS X, iOS, Android, Electron
BSD 3-Clause "New" or "Revised" License
8.89k stars 1.23k forks source link

KBFS crashes with invalid memory address or nil pointer dereference #19151

Open mkmik opened 5 years ago

mkmik commented 5 years ago

my log id: d9c9d1b8ea04ee5b0984341c

I recently made some membership changes in a team and KBFS stopped working. I tried to restart keybase a few times

keybase fs ls /keybase
▶ ERROR Keybase services aren't running - KBFS client not found.
KBFS:
    status:    not running
    version:   4.3.2-20190819174353+b1c5c7c912
    installed: 4.3.2-20190819174353+b1c5c7c912
    log:       /Users/mkm/Library/Logs/keybase.kbfs.log
    mount:

Excerpt from kbfs log:

...
2019-08-27T11:54:58.605535+02:00 ▶ [INFO kbfs mount_interrupter.go:56] 084 Mounting the filesystem was a success
2019-08-27T11:54:58.605896+02:00 ▶ [DEBU kbfs start.go:53] 085 Creating filesystem
2019-08-27T11:54:58.606232+02:00 ▶ [DEBU kbfs start.go:81] 086 Serving filesystem
2019-08-27T11:54:58.612890+02:00 ▶ [DEBU kbfs start.go:76] 093 Mount ready
...
2019-08-27T11:54:58.890683+02:00 ▶ [DEBU kbfs md_ops.go:917] 096 GetForHandle: /keybase/public/mkm merged
...
2019-08-27T11:54:59.380638+02:00 ▶ [INFO kbfs mdserver_remote.go:295] 0b7 authentication successful; ping interval: 30s
...
2019-08-27T11:54:59.552657+02:00 ▶ [DEBU kbfs mdserver_remote.go:315] 0bd requested list of folders for rekey
...
2019-08-27T11:54:59.580613+02:00 ▶ [DEBU kbfs(kbfsfuse) fs.go:355] 0c4 User changed: "" -> "mkm"
2019-08-27T11:54:59.580656+02:00 ▶ [DEBU kbfs kbfs_ops.go:249] 0c5 Forcing fast-forwards for 0 folders
2019-08-27T11:54:59.580674+02:00 ▶ [DEBU kbfs kbfs_ops.go:249] 0c6 Forcing fast-forwards for 0 folders
...
2019-08-27T11:55:01.468445+02:00 ▶ [DEBU kbfs(FBO cba4bc48) folder_branch_ops.go:7791] 0de [duration=159.734657ms] Registering for updates (curr rev = 308, fire now = true) done: <nil> [tags:FBOID=3UVzsv2XZ13qQgG74UHc6Q]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x4d6872f]

goroutine 673 [running]:
github.com/keybase/client/go/kbfs/libkbfs.(*nodeCacheStandard).PathFromNode(0xc422aab920, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/build/go/src/github.com/keybase/client/go/kbfs/libkbfs/node_cache.go:352 +0xaf
github.com/keybase/client/go/kbfs/libkbfs.(*folderBranchOps).syncOneNode(0xc4201c6f00, 0x56f4d00, 0xc4219f48c0, 0x0, 0x0, 0xc422b29680, 0xc421897a70, 0x21, 0xc422b22370, 0x46, ...)
        /Users/build/go/src/github.com/keybase/client/go/kbfs/libkbfs/folder_branch_ops.go:1047 +0x9a
github.com/keybase/client/go/kbfs/libkbfs.(*folderBranchOps).doPartialSync(0xc4201c6f00, 0x56f4d00, 0xc4219f48c0, 0x0, 0xc4218e2ab0, 0x1, 0x1, 0xc422b29680, 0xc421897a70, 0x21, ...)
        /Users/build/go/src/github.com/keybase/client/go/kbfs/libkbfs/folder_branch_ops.go:1183 +0x63d
github.com/keybase/client/go/kbfs/libkbfs.(*folderBranchOps).kickOffPartialSync.func1()
        /Users/build/go/src/github.com/keybase/client/go/kbfs/libkbfs/folder_branch_ops.go:1245 +0x12a
github.com/keybase/client/go/kbfs/libkbfs.(*folderBranchOps).goTracked.func1(0xc4201c6f00, 0xc4229670e0)
        /Users/build/go/src/github.com/keybase/client/go/kbfs/libkbfs/folder_branch_ops.go:518 +0x55
created by github.com/keybase/client/go/kbfs/libkbfs.(*folderBranchOps).goTracked
        /Users/build/go/src/github.com/keybase/client/go/kbfs/libkbfs/folder_branch_ops.go:516 +0x69
mkmik commented 5 years ago

I deleted the "stacksmith" team that I was suspecting was causing issues and the problem went away. I'm "lucky" I intended to delete the team anyway (although I preferred to delete it more gradually).

A possible clue: I created some symlinks pointing to another team; e.g.:

$ cd /keybase/team/stacksmith
$ mv foo ../newteam/
$ ln -s ../newteam/foo .
strib commented 5 years ago

Hi @mkmik, sorry for the rough experience. This is related to #19033, but slightly different because of the symlink. I'll get a fix up soon, but it probably won't make this week's release.

Until then, if this happens to anyone again I think you can get away with just removing the symlink (perhaps via a mobile client if the desktop client is too crashy).