crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 275 forks source link

Multiple resource leaks fixed in proxy and dealer #2098

Open DZabavchik opened 10 months ago

DZabavchik commented 10 months ago

The following resource leaks were identified and fixed:

  1. Proxy doesn't handle client (frontend) disconnects while establishing a backend session (UDS transport) -> UDS handle is leaked, Router retains session indefinitely
  2. Proxy doesn't handle client disconnects in the middle of authentication (HELLO/CHALLENGE, AUTHENTICATE/WELCOME) -> does not close backend session -> UDS handle is leaked, Router retains session from proxy (since there is no ping on UDS, it will never discover client is gone)
  3. Invocations in router were leaked if caller or callee disconnected while invocation(s) were in flight -> referenced caller/callee session objects leaked. Call timeout timers are not cancelled. #2096
  4. Small (startup/static) leak of authenticator sessions in proxy. If there is a flood of connections on startup, each one see absence of authenticator session in _service_sessions[realm][authrole] and try to create one. Last one to be created will be stored overwriting any previous ones. RouterSessions on the router side will never be closed.

Leaks were discovered during stress/load testing with continuous stream of simulated faulty clients (abruptly closing connections at different stages, with invocations in flight, load-balancer failures resulting in mass disconnects).
No leaks were detected in router or proxy processes with fixes.

image

mrrishimeena commented 7 months ago

When can we expect this merge?

oberstet commented 7 months ago

When can we expect this merge?

not before all of the CI runs green

DZabavchik commented 2 months ago

Added few commits to fix most issues with tests. (unit tests and functional tests). Sphinx fails. Runners are stuck in queue.

oberstet commented 2 months ago

Thanks for working on this, and for fixing the tests specifically! rgd the test runners here on GH: yeah, the self-hosted runner machine is used differently now, and unfortunately I hadn't time yet to clean it up and move it to GH hosted runners again yet ..