matterhorn-chat / matterhorn

A feature-rich Unix terminal client for the Mattermost chat system
BSD 3-Clause "New" or "Revised" License
1.05k stars 77 forks source link

high memory use #742

Closed setharnold closed 3 years ago

setharnold commented 3 years ago

Hello, matterhorn is my largest memory consumer at the moment:

top - 18:12:37 up 116 days, 20:09, 18 users,  load average: 1.48, 1.49, 1.16
Tasks: 525 total,   2 running, 523 sleeping,   0 stopped,   0 zombie
%Cpu(s): 13.7 us,  0.7 sy,  0.0 ni, 78.5 id,  0.0 wa,  0.0 hi,  7.1 si,  0.0 st
MiB Mem :  15759.6 total,    335.2 free,  13659.9 used,   1764.6 buff/cache
MiB Swap:   2048.0 total,    721.0 free,   1327.0 used.    910.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                             
 498659 sarnold   20   0 1024.8g   8.0g  16980 S   1.3  51.8 626:24.25 matterhorn                                                                                          
2472391 sarnold   20   0 5054496 621036 217780 S   3.3   3.8  96:16.24 GeckoMain                                                                                           
3774179 sarnold   20   0   37.7g 569576 129980 S  13.6   3.5   9:45.72 chrome                                                                                              
2480297 sarnold   20   0 3303020 452872  85548 R 100.7   2.8  12:59.66 Web Content                                                                                         
2957965 sarnold   20   0 3102016 337660  76292 S   0.0   2.1  13:48.91 Web Content                                                                                         
2480748 sarnold   20   0 3283464 330204 107432 S   0.0   2.0  25:13.15 Web Content                                                                                         
2630347 sarnold   20   0 2973416 287624  74720 S   0.0   1.8   4:05.80 Web Content                                                                                         
3772920 sarnold   20   0 3260140 251576 144084 S   0.3   1.6   0:21.96 chrome                                                                                              
2629946 sarnold   20   0 2695852 214512  67456 S   0.0   1.3   3:09.88 Web Content                                                                                         
2623311 sarnold   20   0 2946940 181404  71028 S   0.3   1.1   8:48.51 Web Content                                                                                         
3787200 sarnold   20   0 2522028 172324  88764 S   0.0   1.1   0:19.51 Web Content                                                                                         
1688852 sarnold   20   0  185156 147240   8936 S   0.3   0.9   3:29.65 x-terminal-emul                                                                                     

Eight gigabytes of memory feels like quite a lot for a text-based chat application. (For comparison, my irssi connected to five or six irc networks, over a hundred windows, with vastly more traffic than my work-only matterhorn, is running on a VM with a total of 512M memory.)

This process was 22 days old, running version:

matterhorn (edge) 50200.13.0-60-ga2b1341f from Marco Trevisan (Treviño) (3v1n0) refreshed

Thanks

jtdaugherty commented 3 years ago

Thanks for the report! This is a duplicate of #682.

jtdaugherty commented 3 years ago

(In the mean time, my recommendation is to restart Matterhorn more often.)

jtdaugherty commented 3 years ago

@setharnold Since you mentioned the exact version, do you see this behavior with the official builds that we publish?

setharnold commented 3 years ago

I haven't tried the 'official builds'; for all I gripe about snap, it's super-easy for me to use the snap builds. I could certainly try the official builds if it'd give us useful data or better debugging etc.

jtdaugherty commented 3 years ago

Okay, thanks. I don't think that's going to be necessary. I just asked because we haven't been able to reproduce the problem, and I wanted to be sure there wasn't something super different about your build. Granted, if you're using the Snap build, I have no idea what version of GHC is being used to make that build, but while that is an unknown I really doubt it has the potential to cause the memory behavior you're seeing. Also, enough other people have reported this that unless they all happen to be running the Snap build, I wouldn't suspect that.

jtdaugherty commented 3 years ago

(Also, a user who was able to do a profiling build of Matterhorn still had this problem and thus wasn't using the Snap build, so that is the main evidence I have against worrying about the Snap version.)

setharnold commented 3 years ago

There may be some hints in the executable itself:

$ strings /snap/matterhorn/259/app/matterhorn | grep -i ghc
/root/.cabal/lib/x86_64-linux-ghc-8.6.5/matterhorn-50200.13.0-inplace
/root/.cabal/lib/x86_64-linux-ghc-8.6.5
/root/.cabal/share/x86_64-linux-ghc-8.6.5/matterhorn-50200.13.0
/root/.cabal/libexec/x86_64-linux-ghc-8.6.5/matterhorn-50200.13.0
/root/.cabal/lib/x86_64-linux-ghc-8.6.5/mattermost-api-50200.11.0-inplace
/root/.cabal/share/x86_64-linux-ghc-8.6.5/mattermost-api-50200.11.0
/root/.cabal/libexec/x86_64-linux-ghc-8.6.5/mattermost-api-50200.11.0
...
GHC 8.6.5

My guess, skimming the build recipe, is that it's using the ghc package from Ubuntu 20.04, with the confusing version string 8.8.1+dfsg1+is+8.6.5+dfsg1-3.

jtdaugherty commented 3 years ago

Thanks! Gotta love distribution package re-versioning. 😊

setharnold commented 3 years ago

Yeah! There's nothing quite like seeing a small mistake seared into version strings for the next ten years... Oh well. :)