Skip to content

[python] make LogScanner poll methods async to prevent event loop blocking - #495

Merged
leekeiabstraction merged 1 commit into
apache:mainfrom
fresh-borzoni:feat/async-poll-api
May 3, 2026
Merged

[python] make LogScanner poll methods async to prevent event loop blocking#495
leekeiabstraction merged 1 commit into
apache:mainfrom
fresh-borzoni:feat/async-poll-api

Conversation

@fresh-borzoni

@fresh-borzoni fresh-borzoni commented Apr 17, 2026

Copy link
Copy Markdown
Member

closes #496

Converts LogScanner's poll(), poll_record_batch(), poll_arrow(), to_arrow() and to_pandas() from sync (py.detach + block_on) to async via future_into_py, so scanning no longer blocks the asyncio event loop.

With the public API now async, the private _async_poll and _async_poll_batches helpers are redundant and have been removed. Test fixtures back to session level and don't use global connection caching.

Per-bucket stopping-offset tracking in to_arrow/to_pandas, timeout validation, partition handling and error propagation are preserved.

@fresh-borzoni fresh-borzoni changed the title feat: make LogScanner poll methods async to prevent event loop blocking [python] make LogScanner poll methods async to prevent event loop blocking Apr 17, 2026
Convert poll(), poll_record_batch(), poll_arrow(), to_arrow(), to_pandas()
from sync (py.detach + block_on) to async (future_into_py).

The sync methods blocked the asyncio event loop thread, preventing
concurrent future_into_py tasks from delivering results. This caused
deadlocks when users ran multiple async operations simultaneously.

Breaking change: these methods now return awaitables instead of direct values.
@fresh-borzoni

Copy link
Copy Markdown
Member Author

@luoyuxia @leekeiabstraction PTAL 🙏

@leekeiabstraction leekeiabstraction left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, TY for the PR!

@leekeiabstraction
leekeiabstraction merged commit 92a614f into apache:main May 3, 2026
9 of 10 checks passed
@leekeiabstraction

Copy link
Copy Markdown
Contributor

Ah, seemed like the CI has failed on main after this merge.

https://github.com/apache/fluss-rust/actions/runs/25278873151/job/74112896178

Appreciate if you can have a look @fresh-borzoni

@fresh-borzoni

Copy link
Copy Markdown
Member Author

@leekeiabstraction already taking a look, np

@fresh-borzoni

Copy link
Copy Markdown
Member Author

addressed: #527

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.

[python ] LogScanner poll API is sync and blocks the asyncio event loop

2 participants