`CREATE TABLE` / `DROP TABLE` hang on a current-thread tokio runtime and panic outside a runtime
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start in crates/datafusion/src/schema.rs at the register_table and deregister_table implementations linked in the issue, then reproduce the behavior with the delayed catalog on a current-thread Tokio runtime and outside any runtime. Trace how the synchronous SchemaProvider methods wait for catalog operations. Done means CREATE TABLE and DROP TABLE complete or return an error on both runtime flavors without panicking outside a runtime.
Written by the indexing model from the issue text.
Description
Describe the bug
IcebergSchemaProvider::register_table and deregister_table are synchronous SchemaProvider methods that DataFusion calls while executing SQL. They run the catalog call inside tokio::task::spawn_blocking with Handle::current().block_on, then wait for the JoinHandle with futures::executor::block_on on the calling thread (schema.rs#L176-L207, schema.rs#L221-L243).
That blocks the thread that called into DataFusion. On a current-thread runtime, that thread is the only one that drives tokio's I/O and timer drivers. Handle::block_on on the blocking-pool thread doesn't drive them, so a catalog call that awaits network I/O or a timer never completes. That covers REST, Glue, HMS and similar catalogs.
To Reproduce
- Wrap a
MemoryCatalogin aCatalogimplementation whose methods awaittokio::time::sleep(Duration::from_millis(2))before delegating, to stand in for a network catalog. - On a runtime built with
tokio::runtime::Builder::new_current_thread().enable_all(), register it throughIcebergCatalogProviderand runCREATE TABLE ice.ns.created (id INT NOT NULL).
No result after 10 seconds: the statement hangs.
Calling register_table from a thread with no tokio runtime panics:
thread '<unnamed>' panicked at crates/datafusion/src/schema.rs:177:22:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
On a multi-thread runtime the statement completed in this test, but it keeps the calling thread blocked for the whole catalog round trip.
Expected behavior
CREATE TABLE and DROP TABLE complete or return an error on either runtime flavor. The synchronous methods don't panic when called outside a runtime.
Additional context
#24 (section 3) discusses moving remote create/drop behind an async boundary; this issue is the concrete failure in the current implementation. #[tokio::test] uses a current-thread runtime by default. The existing tests pass only because MemoryCatalog on a local filesystem never needs the I/O or timer driver.
- Dominant language
- Rust
- Stars
- 30
- Forks
- 30
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 15
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/datafusion-iceberg
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/datafusion-iceberg#100 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
apache/datafusion-iceberg#85 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
apache/datafusion-iceberg#84 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
apache/datafusion-iceberg#75 ·
Maintainers usually reply within 1 day
-
Slow CI runnersOpen
Difficulty 4/5 3-5 days Newbie friendliness 18/100
apache/datafusion-iceberg#74 ·
Maintainers usually reply within 1 day
All issues in apache/datafusion-iceberg
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
🐞 bug 🧩 bevy_gantz_egui
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
nannou-org/gantz#500 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
metasequoiaime/msime#10989 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
fritzprix/libr-agent#2612 ·
Maintainers usually reply within 1 day
-
find: -printf %h drops a doubled slashPossibly taken @qodelicious claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day