Skip to content

Fix thread-safety in GlobalKaleidoServer: replace shared return queue with per-task Futures#431

Open
talleibman wants to merge 1 commit intoplotly:masterfrom
talleibman:fix/per-task-futures-thread-safety
Open

Fix thread-safety in GlobalKaleidoServer: replace shared return queue with per-task Futures#431
talleibman wants to merge 1 commit intoplotly:masterfrom
talleibman:fix/per-task-futures-thread-safety

Conversation

@talleibman
Copy link

We hit an issue in production where concurrent call_function calls occasionally returned each other's results. The shared _return_queue has no guarantee that the caller who put the task gets the matching result back.

Fix: each Task now carries its own concurrent.futures.Future. The worker sets the result/exception directly on it, and the caller blocks on future.result().

Tested locally with Python 3.8 and 3.14.

Thanks for the review!

Avoids potential result/caller mismatch when multiple threads call
call_function concurrently—each caller now blocks on its own Future.
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.

1 participant