keybase / kbfs

Keybase Filesystem (KBFS)
https://keybase.io/docs/kbfs
BSD 3-Clause "New" or "Revised" License
1.21k stars 137 forks source link

Enormous KBFS memory usage when not doing anything (Arch Linux) #1958

Open quantum-dan opened 5 years ago

quantum-dan commented 5 years ago

So right now I'm not uploading or downloading anything (and the Keybase app agrees, it says "Done" with regards to files) and my memory usage looks like this: 2018-12-08_12 02 21

Log ID: bb31cd3b22499f77350fce1c

That's a fraction of my memory, but it's enough to cause noticeable slowdown here and there.

Yesterday I started making a Veracrypt container but changed my mind and cancelled it, so that's not being uploaded. I just finished making a backup to my private directory using Borg Backup a couple of hours ago, so I could understand the memory usage back then, but it's still high a few hours later.

strib commented 5 years ago

2 things:

quantum-dan commented 5 years ago
da-code-a commented 5 years ago

This issue just appeared in the latest update on an Ubuntu 18.04 system as well. Computer slowed down to a halt, couldn't even send a Slack message until I killed the main kbfsfuse process. See screenshot:

2018-12-20-081821

strib commented 5 years ago

I'm very confused, there should only be one kbfsfuse process running at a time. Where are the other ones coming from? cc: @heronhaye

Anyway @DonaldKBrown please run keybase log send, and if you're still having the issue while kbfs is running and mounted, please also save the contents of the /keybase/.kbfs_profiles directory.

heronhaye commented 5 years ago

I believe it's the different threads, you can turn off hide userland process threads in F2.

da-code-a commented 5 years ago

@strib : My log id is b3e1deb590f3212f0f10411c. Thank you for looking into this. @heronhaye : I like to keep them displayed to see if anything is spawning more than it should. It sometimes makes it difficult to find what I'm looking for, but I've gotten used to it :wink:

maxtaco commented 5 years ago

Agreed almost certainly the same process, since the memory stats all line up. Also note slack showing the same thing.

strib commented 5 years ago

Ok thanks. @DonaldKBrown are you still having the high memory usage? If so, can you share the contents of /keybase/.kbfs_profiles/ with me? Like cp -r /keybase/.kbfs_profiles/{block,goroutine,heap,mutex} /keybase/private/strib,donaldkbrown. Thanks!

From the log it seems busy prefetching a big file from one of your team folders into your local disk cache, to give you fast access to it if you want it. This is a new feature with this release so it must have a few bugs. It's obviously not supposed to slam your CPU or cause a memory leak, so I'll look into it. But it'd be helpful to get a memory profile so I can tell where the leak is.

da-code-a commented 5 years ago

@strib After killing the main thread, I initially wasn't able to access KBFS through Nautilus; it gave a "Software caused connection abort" error. I opened the Keybase desktop app and selected the "Files" tab, which reconnected me to KBFS. Memory usage appears normal now, I've shared those files with you.

strib commented 5 years ago

Ok thanks. If you see that again, please capture those profile files before you kill it, if possible. Inspecting the code I do see one more possible leak, so I'll fix it soon and we'll go from there...