codope opened a new pull request, #766:
URL: https://github.com/apache/hudi-rs/pull/766
## Description
cxx's generated shims are `extern "C"`, so a panic reachable from a read (an
unsupported Avro type in `avro_to_arrow`, an internal invariant in the log
scanner) unwinds out of the shim and aborts the host process. An engine that
embeds the library in a long-lived multi-tenant worker loses every co-running
query to one bad read.
This wraps each `extern "Rust"` entry point in `catch_unwind` and reports
the panic through the `Result` the bridge already throws as `rust::Error`, as
`"<entry point> panicked: <message>"`. The call fails; the reader stays usable.
The four bridge declarations now document this in the generated header.
Two small side effects:
- `hudi-test` moves to `[dev-dependencies]`; it is only used by the new
tests and consumers should not pull the fixture crate.
- The default panic hook still prints the panic to stderr. Embedders that
find that noisy can install their own hook.
The `todo!()`s in `avro_to_arrow` and the scanner `unwrap_*` helpers that
the issue lists as panic sources are left for a separate `fix(core)` PR; this
one is the safety net at the boundary.
Closes #636. Related: apache/hudi#18308.
## How are the changes test-covered
- [ ] N/A
- [x] Automated tests (unit and/or integration tests)
- [ ] Manual tests
- [ ] Details are described below
Unit tests in `cpp/src/lib.rs`: the guard for `&str`, `String` and
non-string payloads; error paths of each entry point through the real cxx
types; a happy-path read of a COW fixture through the bridge; and a panic
inside the reader's `block_on` followed by a successful read on the same reader.
--
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]