keybase / keybase/client

`keybase chat read` leaks unbounded amounts of memory

Open
#18,835 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

Version: 4.1.0, 64-bit linux; I've also seen this on 3.x, but it's only now that I've been able to track down the cause.

Every time `keybase chat read` is called, the keybase daemon appears to leak a small amount of memory. In uses where it's called repeatedly, this means that the daemon's memory usage will grow without bound, until either it OOMs or the user notices and manually restarts it.

A simple and relatively quick reproduction is:

while true; do
keybase chat read >/dev/null
done

and when watch htop in another window.

On my machine this grows fairly slowly, perhaps 1MB/s, but this is still enough that within a few hours the system will become unusable.

Other `keybase chat` commands may exhibit the same behaviour, but `keybase chat read` is the only one I'm completely sure of at this point.

Contributor guide

No contributing guide indexed for this repository

Research direction

The reported entry point is `keybase chat read`, with the shell loop in the issue as a reproduction. Start by running that loop while observing the keybase daemon's memory, then investigate the daemon path serving the command with a memory profiler. Done means repeated reads no longer cause unbounded daemon memory growth.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.