Potential memory leak in Transport.start_server
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm not sure if this is a leak or an ambiguity on how to use the async version of Transport.start_sever with event being passed, and how to synchronize/accept the client on the server transport.
See https://gist.github.com/mdellavo/9dd98e6223c6f815ad45 -- this version passes an event to Transport.start_server and does not call Transport.accept(), after the transport disconnects, we see that there is an unaccepted Channel in Transport.server_accepts that is now disconnected. Due to the circular reference held between Channel and Transport , this causes a memory leak.
We've also seen in our production code that calling Transport.accept() will return "channel closed" on the client, though this may be unrelated.
See https://gist.github.com/mdellavo/d349cbc9ffc3b30c1862 -- this version does uses the synchronous version (no accept), calls Transport.accept() and functions normally.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the async Transport.start_server path described in the first gist, then inspect Transport.server_accepts, Transport.accept(), and the Channel/Transport references during disconnect. Reproduce the unaccepted-channel case and compare it with the synchronous example; done means the retention behavior and accept semantics are resolved and covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100