Skip to content

Conversation

@lidavidm
Copy link
Member

This gives a slightly nicer experience than unconditionally crashing the entire program. As with the Go FFI scaffolding, once a driver panics, all further calls to the driver will fail. (Albeit, this is not true for exported readers. We also need our own C Data Interface export shim so we can handle things like exporting ADBC errors through the C Data Interface boundary. Currently, C++ and Go-based drivers can do this.)

@lidavidm lidavidm force-pushed the catch-panic branch 7 times, most recently from e1f661e to a2d7fc3 Compare December 26, 2025 05:27
@lidavidm lidavidm marked this pull request as ready for review December 26, 2025 06:05
@github-actions github-actions bot added this to the ADBC Libraries 22 milestone Dec 26, 2025
@lidavidm lidavidm requested a review from amoeba December 26, 2025 06:11
@lidavidm
Copy link
Member Author

also CC @eitsupi if you're interested

@lidavidm lidavidm requested a review from mbrobbel December 26, 2025 06:11
Copy link
Member

@amoeba amoeba left a comment

Choose a reason for hiding this comment

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

Really nice. I hadn't seen the old behavior so I disabled it and re-ran the new tests and this PR is a big improvement. I had one question and a really tiny nit if you agree.

Copy link
Contributor

@eitsupi eitsupi left a comment

Choose a reason for hiding this comment

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

Great!

I found some points to be improved.

/// # Parameters
///
/// - `$func_name` - Driver's initialization function name. The recommended name
/// is `AdbcDriverInit`, or a name derived from the name of the driver's shared
Copy link
Contributor

@eitsupi eitsupi Dec 28, 2025

Choose a reason for hiding this comment

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

Perhaps the documentation needs to be updated to state that "AdbcDriverInit is a reserved name" (no longer be able to used after this change), and perhaps the PR should be renamed to feat(rust/ffi)! ... to make it clear that it is a breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I should update that comment...the name should be the latter (a driver should provide both)

@lidavidm lidavidm changed the title feat(rust/ffi): catch panics at FFI boundary Dec 29, 2025
@lidavidm
Copy link
Member Author

I think 22b954d needs a slight fix which I'll look at

@lidavidm
Copy link
Member Author

lidavidm and others added 5 commits December 29, 2025 15:27
This gives a slightly nicer experience than unconditionally
crashing the entire program.  As with the Go FFI scaffolding,
once a driver panics, all further calls to the driver will fail.
(Albeit, this is not true for exported readers.  We also need our
own C Data Interface export shim so we can handle things like
exporting ADBC errors through the C Data Interface boundary.
Currently, C++ and Go-based drivers can do this.)
Co-authored-by: eitsupi <50911393+eitsupi@users.noreply.github.com>
Co-authored-by: Bryce Mecum <petridish@gmail.com>
Co-authored-by: Bryce Mecum <petridish@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants