Xuanwo opened a new pull request, #8866:
URL: https://github.com/apache/opendal/pull/8866

   # Which issue does this PR close?
   
   N/A.
   
   # Rationale for this change
   
   `bindings/cpp` maintains a shared Tokio multi-threaded runtime 
(`crate::RUNTIME`) used by the synchronous `Operator` through 
`into_blocking_operator`, but the C++20 async binding 
(`bindings/cpp/src/async.rs`) never entered that runtime when constructing 
operators, polling or dropping `cxx_async` futures, or dropping async handles.
   
   Because `cxx_async` polls and drops Rust futures directly on the C++ caller 
thread and aborts the process on any panic/unwind, any Tokio-backed 
service—including local `fs` (`tokio::fs`)—panicked with `"there is no reactor 
running, must be called from the context of a Tokio 1.x runtime"` and 
immediately terminated the C++ process with `SIGABRT`. Existing async tests 
only exercised `memory`, which never touches Tokio.
   
   # What changes are included in this PR?
   
   - Add a `TokioRuntimeFuture<F>` adapter in `bindings/cpp/src/async.rs` that 
enters `crate::RUNTIME` around both `Future::poll` and `Drop`, and wrap all 
async FFI futures (`operator_*`, `reader_read`, `lister_next`) with it.
   - Enter `crate::RUNTIME` in `new_operator`, `Operator::drop`, 
`delete_reader`, and `delete_lister` so service construction and destructor 
cleanup also run with an active Tokio runtime context.
   - Add a deterministic C++ async regression test 
(`AsyncFsOpendalTest.TokioBackedFsOperations`) in 
`bindings/cpp/tests/async_test.cpp` using the `fs` service against a temporary 
directory.
   
   # Are there any user-facing changes?
   
   `opendal::async::Operator` now works with `fs` and other Tokio-backed 
services instead of aborting with `SIGABRT`. No public C++ or Rust API 
signatures changed.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: pi / T3 Code
   - Model: Gemini 4 Neon
   - Effort: High
   - Role: Investigated the crash, reproduced the `SIGABRT` locally with a new 
`fs` async test, implemented the `TokioRuntimeFuture` and lifecycle 
runtime-entry fix in `bindings/cpp/src/async.rs`, added the regression test in 
`bindings/cpp/tests/async_test.cpp`, and ran local formatting, clippy, and C++ 
sync/async/sanitizer test suites.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to