-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove catch_unwind wrapper around the rust query planner #6397
Conversation
There were several panic!() marcos still in use in `apollo-federation`. Instead of panicking, these functions now return the expected FederationError. If you're searching in the code, you'll still see a few panics. They are in tests, in macros or function annotated with `#[cfg(test)]`, or in [unused] composition part of the codebase. More specifically: * in internally used [CLI](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/cli/src/main.rs#L214) * in tests: * [operation tests](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/src/operation/tests/mod.rs) * [build query graph tests](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/src/query_graph/build_query_graph.rs#L2448) * [api schema tests](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/tests/api_schema.rs) * [build query plan support tests](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/tests/query_plan/build_query_plan_support.rs) * [context build query plan test](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/tests/query_plan/build_query_plan_tests/context.rs) * [fetch operation name tests](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/tests/query_plan/build_query_plan_tests/fetch_operation_names.rs) * test helpers annotated with `#[cfg(test)]`: * [connectors' json selection test helper](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/src/sources/connect/json_selection/apply_to.rs#L116) * [connectors selection! macro](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/src/sources/connect/json_selection/helpers.rs#L10) * [argument merge strategies](https://github.com/apollographql/router/blob/85f99f19e2a2907bd5597687773d68d63644a0c6/apollo-federation/src/schema/argument_composition_strategies.rs) used solely in composition
We were adding backtrace captures to SingleFederationErrors in order to help with debugging unexpected errors while were still developing the rust query planner. Capturing backtraces is quite often [a slow and memory intensive process](https://doc.rust-lang.org/stable/std/backtrace/struct.Backtrace.html#method.capture), so we want to remove this additional functionality for rust query planner's GA. Since we now have a lot of confidence in this implementation and have not faced a panic across millions of operations that were tested and compared, this is a safe thing to remove.
✅ Docs Preview ReadyNo new or changed pages found. |
CI performance tests
|
Since we are now confident in rust query planner's implementation, we no longer need to catch_unwind when planning an operation in Rust.
4e62f81
to
8e9e23b
Compare
@TylerBloom I'd like your review on this, since you're working on tidying up the federation errors and I want to make sure this aligns with that you're doing. @SimonSapin I'd also like your review on this, since you initially set up the catch_unwind and backtrace capture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Federation side LGTM. Added a few suggestion to use bail!
and internal_error!
for consistency.
Ya, this is inline with what I've been working on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with one minor change
// Once we've panic'ed the behaviour of the router is non-deterministic | ||
// We've logged out the panic details. Terminate with an error code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if
condition should be indeed removed but the comment is still relevant and should be kept
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooops, thank you for catching!
This PR removes catch_unwind around the invocation of the rust query planner. As part of this change, I have changed all applicable
panic!()
s inapollo-federation
, as well as remove adding a backtrace capture toSingleFederationErrors
.Details
panic()!
at theapollo-federation
There were several panic!() marcos still in use in
apollo-federation
. Instead of panicking, these functions now return the expected FederationError.If you're searching in the code, you'll still see a few panics. They are in tests, in macros or function annotated with
#[cfg(test)]
, or in [unused] composition part of the codebase. More specifically:#[cfg(test)]
:Removing backtrace capture
We were adding backtrace captures to
SingleFederationErrors
in order to help with debugging unexpected errors while were still developing the rust query planner. Capturing backtraces is quite often a slow and memory intensive process, so we want to remove this additional functionality for rust query planner's GA. Since we now have a lot of confidence in this implementation and have not faced a panic across millions of operations that were tested and compared, this is a safe thing to remove.Note: The compliance CI is failing at the moment, and will be fixed after #6395 is merged
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
DocumentationChangeset 2 completedPerformance impact assessed and acceptableUnit TestsIntegration TestsManual TestsFootnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩