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

Missing task done call in AsyncBulkCall #232

Closed
giffels opened this issue Mar 2, 2022 · 2 comments · Fixed by #238
Closed

Missing task done call in AsyncBulkCall #232

giffels opened this issue Mar 2, 2022 · 2 comments · Fixed by #238
Assignees
Labels
potential problem Avoid foreseeable misuse

Comments

@giffels
Copy link
Member

giffels commented Mar 2, 2022

It seems that AsyncBulkCall is missing one task_done call. The simplify the logic, we can assume that size is set to 1.

In that case the first task is fetched in

results = [await queue.get()]

the while loop in

while len(results) < max_items and time.monotonic() < deadline:
is skipped.

and therefore task_done in

queue.task_done()
in never called.

More generally speaking there is always one task_done call missing independent of size.

@giffels giffels added the potential problem Avoid foreseeable misuse label Mar 2, 2022
@maxfischer2781
Copy link
Member

Makes sense. We only have a queue.task_done() for each get in the loop, but none for the get outside it.

I'm guessing this isn't an immediate problem since nothing actually checks whether the queue is done. Still it would be useful to fix if we ever do anything that relies on this, e.g. shutting down the worker if there is no work at all.

@maxfischer2781
Copy link
Member

Looks like there is also an issue that the bulk task could get garbage collected depending on its payload. We need to keep a strong reference to all tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential problem Avoid foreseeable misuse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants