Skip to content

Fix io_runtime drop panic in test_postgres_io_runtime_segregation#560

Merged
lukekim merged 3 commits into
datafusion-contrib:mainfrom
alexanderbianchi:fix/io-runtime-test-drop-panic
Mar 13, 2026
Merged

Fix io_runtime drop panic in test_postgres_io_runtime_segregation#560
lukekim merged 3 commits into
datafusion-contrib:mainfrom
alexanderbianchi:fix/io-runtime-test-drop-panic

Conversation

@alexanderbianchi
Copy link
Copy Markdown
Contributor

@alexanderbianchi alexanderbianchi commented Mar 4, 2026

Summary

Fixes the test_postgres_io_runtime_segregation test panic mentioned in #559.

The test creates a tokio::runtime::Runtime (io_runtime) inside an async fn. When the function returns, Rust drops io_runtime, and Runtime::drop performs a blocking shutdown to wait for spawned tasks. Since the test runs on a Tokio worker thread (via #[tokio::test]), blocking is not allowed — causing the panic:

Cannot drop a runtime in a context where blocking is not allowed.
This happens when a runtime is dropped from within an asynchronous context.

The fix calls io_runtime.shutdown_background() before the end of the test, which consumes the runtime and initiates a non-blocking shutdown, avoiding the panic.

Test plan

  • test_postgres_io_runtime_segregation no longer panics

@alexanderbianchi alexanderbianchi force-pushed the fix/io-runtime-test-drop-panic branch from 54ff9f9 to 3471d4d Compare March 4, 2026 01:44
@lukekim lukekim enabled auto-merge (squash) March 13, 2026 02:17
@lukekim lukekim merged commit ba1c0b9 into datafusion-contrib:main Mar 13, 2026
11 checks passed
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.

3 participants