status-go icon indicating copy to clipboard operation
status-go copied to clipboard

Memory leak when running a Matterbridge with Wakuv2

Open jakubgs opened this issue 11 months ago • 1 comments

Problem

This problem was discovered while working on deployment of our Matterbridge fork developed by @endulab :+1:

  • https://github.com/status-im/infra-misc/issues/250

Despite increasing host size the memory usage keep growing until the host is full and SWAPping starts:

image

This issue is unlikely to be in the Matterbridge code as it's a well established software, and our Waku additions are minimal.

jakubgs avatar Mar 26 '24 13:03 jakubgs

Granted Michał SSH access to use pperf over SSH:

jakubgs avatar Mar 27 '24 16:03 jakubgs

Created pprof reports. Already sent to @richard-ramos report with memory used.

Image

endulab avatar Apr 02 '24 10:04 endulab

Could be fixed by https://github.com/status-im/status-go/pull/5012

jrainville avatar Apr 03 '24 21:04 jrainville

I updated bridge with the latest status-go. Let's see what happens. @jakubgs please update the bridge.

https://github.com/status-im/matterbridge/pull/8

endulab avatar Apr 04 '24 13:04 endulab

The port 6060 was not mapped from the container:

[email protected]:/docker/matterbridge-community % grep -A5 ports docker-compose.yml
    ports:
      - '4343:4343'

Fixed it manually for now:

[email protected]:/docker/matterbridge-community % sudo netstat -lpnt | grep 6060
tcp        0      0 0.0.0.0:6060            0.0.0.0:*               LISTEN      911/dockerd   

It works over SSH tunnel: ssh -N -L 6060:0:6060 node-01.do-ams3.bridge.misc.status.im

 > curl -s 0:6060/debug/pprof/cmdline | cat 
/bin/matterbridge-conf=/config/matterbridge.yaml

jakubgs avatar Apr 16 '24 13:04 jakubgs

release/0.177.x now contains https://github.com/status-im/status-go/pull/5061 Can we update the bridge to point to 79055f10aac2a0ed97fe022329afcab52dcfcfc6 or the HEAD of release/0.177.x? It should fix the issue.

jrainville avatar May 02 '24 14:05 jrainville

@jakubgs I upgraded the bridge. It contains memory issue fix. Please use again this branch and lets monitor. FYI @jrainville

endulab avatar May 06 '24 10:05 endulab

Thanks. I've built the updated enabling-pprof branch and pushed the image:

[email protected]:/docker/matterbridge-community % d
CONTAINER ID   NAMES                    IMAGE                                       CREATED          STATUS
d294d6e741df   matterbridge-community   statusteam/matterbridge:1.26.1-dev-wakuv2   10 seconds ago   Up 8 seconds
fe68655db556   matterbridge-legacy      statusteam/matterbridge:v1.26.0-status      6 weeks ago      Up 10 days

Lets see what happens.

jakubgs avatar May 06 '24 13:05 jakubgs

Last 3 days. Memory consumption on a constant level:

image

I will upgrade wakuv2 branch with a new version of status-go and turn off the profiler.

endulab avatar May 09 '24 07:05 endulab