Skip to content

Comments

server: clean up old unused connections#43

Merged
kaichaosun merged 1 commit intokaichaosun:mainfrom
gdesmott:cleanup
May 26, 2025
Merged

server: clean up old unused connections#43
kaichaosun merged 1 commit intokaichaosun:mainfrom
gdesmott:cleanup

Conversation

@gdesmott
Copy link
Contributor

Once a client was established, server kept listening on its TCP socket forever. Neither the listener or its task was ever cleaned up, resulting in memory and fd usage growing forever until we eventually run of fds.

Fix it by removing clients which have not been used for one hour.

Err(_) => {
// timeout, cleanup old connections
let mut manager = manager.lock().await;
manager.cleanup().await;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Websocket, the longer time connection is expected, if this changes applied, does it mean the websocket connection will be closed after 60 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the client won't be removed if at least one WebSocket is still actually using the tunnel.

But I can make it to whatever duration you prefer regardless.

Once a client was established, server kept listening on its TCP socket
forever. Neither the listener or its task was ever cleaned up,
resulting in memory and fd usage growing forever until we eventually
run of fds.

Fix it by removing clients which have not been used for one hour.
@kaichaosun kaichaosun merged commit 322c9fd into kaichaosun:main May 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants