opensensorhub / osh-core

OpenSensorHub Core Modules
http://docs.opensensorhub.org
Mozilla Public License 2.0
32 stars 16 forks source link

Memory leak in SOS websocket impl #172

Closed alexrobin closed 3 years ago

alexrobin commented 3 years ago

A memory leak becomes quickly visible when issuing many websocket requests. It impacts v1.4 and maybe v2.0

alexrobin commented 3 years ago

It seems the issue is caused by a reference to the websocket session that is not nullified on close

mikebotts commented 3 years ago

Alex. Does this affect how we should develop drivers or does it seem to be confined to core?

alexrobin commented 3 years ago

No impact on drivers. It's confined to core (SOS impl). Mathieu is working on a fix.

mdhsl commented 3 years ago

The memory leak appears when using the WebSocket service only. After investigation, we see that the listener of Jetty maintains a reference to the SOSWebSocketOut object which prevents it from being GC.

Next: https://stackoverflow.com/questions/55829525/potential-memory-leak-of-websocket-sessions-in-jetty-9-4-15

and updating Jetty to version 9.4.42.v20210604, the memory leak has gone.

The solution is simply to update Jetty

image

mikebotts commented 3 years ago

Super. Good job. How might have this issue manifested itself in the server and in the COP?