This block + 6,000 more — yours with Pro

Chat Message Search

112/200
Docs
#engineering-bugs3 members
LK
Lena Kowalski11:02 AM

Has anyone looked into the memory leak in the dashboard service? Production metrics show a steady climb.

ME
You11:04 AM

I noticed that too. The heap snapshot shows a lot of unreleased event listeners on the WebSocket connection.

LK
Lena Kowalski11:05 AM

Makes sense. We added the real-time dashboard updates last sprint. The cleanup function might be missing in the useEffect.

MC
Marcus Chen11:08 AM

I can confirm — I checked the WebSocket hook and there's no return cleanup. Each re-render opens a new connection without closing the old one.

ME
You11:10 AM

That explains the connection count we're seeing. Node process has over 2,000 open WebSocket connections per pod.

MC
Marcus Chen11:12 AM

I'll fix the hook now. Should be straightforward — just need to return ws.close() from the effect and add the dependency array.

LK
Lena Kowalski11:14 AM

Can you also add connection pooling? We should reuse connections across components instead of creating new ones for each dashboard widget.

MC
Marcus Chen11:16 AM

Good idea. I'll create a WebSocket provider at the app level so all dashboard components share a single connection.

ME
You11:18 AM

That's the right approach. Make sure to handle reconnection logic in the provider too — exponential backoff with jitter.

LK
Lena Kowalski11:20 AM

Once the fix is deployed, I'll monitor the memory metrics for 24 hours to confirm the leak is resolved. The dashboard should stabilize around 200MB per pod.

MC
Marcus Chen11:45 AM

PR is up: #1847. Added the cleanup, connection pooling provider, and reconnection with backoff. Ready for review.

ME
You11:50 AM

Reviewing now. Looks clean. One suggestion — add a max reconnection attempt limit so it doesn't retry forever if the server is down.