fix(rpc): catch :exit/:throw from erpc.call; handle {:exception, :terminating} (OPS-4536)#8
Open
palantir-valiot[bot] wants to merge 1 commit into
Open
Conversation
…minating} (OPS-4536)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Catch
:exit(including the{:exception, :terminating}form thaterpc.callsurfaces when the remote MFA doesexit(R)) and:throwinRelix.RPC.execute/1. Previously these bypassed therescueand propagated as unhandled exits, crashing callers such asTokenHelper.authorize_token_via_rpc(valiot_app) at the first occurrence.The change:
:erpc.callin bothrescue(for exceptions) andcatch :exit, .../catch :throw, ....{:error, {:rpc_exit, reason}}asresp_bodyso the RPC struct hasstatus: :executedandRPC.response/1returns{:error, ...}instead of crashing the process.{:error, ...}results.Files changed:
lib/relix/rpc/relix_rpc.ex,test/relix_test.exs,mix.exs,mix.lock,CHANGELOG.md.Why
Root cause of OPS-4536 (eliot-lamosa-gto-prod): unhandled
{:exception, :terminating}fromerpc.callatlib/relix/rpc/relix_rpc.ex:60(stack:Relix.RPC.execute/1→TokenHelper.authorize_token_via_rpc→ Context plug → GraphQL).Triage: NOTIFY+FIX, severity high, category code_bug. This is a missing error-handling path on a first-party RPC helper; frequency 0 does not downgrade it.
Test plan
mix test(was red for the new case before the edit; 7/7 green after: 1 doctest + 6 tests including two new ones for{:exception, :terminating}andthrow)mix formatmix hex.outdated, bumped allowed dev depex_doc0.40.1 → 0.40.3 (and transitivemakeup_erlang) in the same PR; updatedmix.lockgit diffinspected before commit (no debug prints, no scope creep, no empty diff)git push-safe(never plaingit push)Closes OPS-4536