Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check CapacityLimiter's handling of _pending_borrowers #548

Closed
njsmith opened this issue Jun 15, 2018 · 0 comments
Closed

Check CapacityLimiter's handling of _pending_borrowers #548

njsmith opened this issue Jun 15, 2018 · 0 comments

Comments

@njsmith
Copy link
Member

njsmith commented Jun 15, 2018

I was just reading the code for an unrelated reason, and realized that this code looks very suspicious:

trio/trio/_sync.py

Lines 286 to 296 in 65729b1

try:
self.acquire_on_behalf_of_nowait(borrower)
except _core.WouldBlock:
task = _core.current_task()
self._pending_borrowers[task] = borrower
await self._lot.park()
except:
await _core.cancel_shielded_checkpoint()
raise
else:
await _core.cancel_shielded_checkpoint()

Specifically, if the call to await self._lot.park() gets cancelled, it looks like we don't clear self._pending_borrowers[task], which could be a memory leak (since it pins task objects in memory).

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

No branches or pull requests

1 participant