Skip to content

fix: null socket on bb process exit/error in native_socket.ts#22309

Merged
ludamad merged 1 commit into
merge-train/barretenbergfrom
claudebox/1164aa0ab601318b-5
Apr 3, 2026
Merged

fix: null socket on bb process exit/error in native_socket.ts#22309
ludamad merged 1 commit into
merge-train/barretenbergfrom
claudebox/1164aa0ab601318b-5

Conversation

@AztecBot

@AztecBot AztecBot commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Defensive hardening of the native socket backend used by ChonkBatchVerifier.

When the bb helper process crashes (e.g. SIGABRT), the socket was destroyed but the reference was not nulled. This meant subsequent calls to call() would pass the if (!this.socket) guard and attempt to write to a destroyed socket. While the existing socket error/end handlers would eventually reject callbacks via async error events, nulling the socket makes the guard clause reject immediately — fail-fast rather than relying on async error propagation.

Changes:

  • Null this.socket after destroy() in process error handler
  • Null this.socket after destroy() in process exit handler
  • Null this.socket after destroy() in cleanup() method

Test plan

  • Existing unit tests should pass — this is a defensive null assignment, no behavior change for healthy paths
  • On process crash, calls to call() now throw Socket not connected immediately instead of writing to a destroyed socket and waiting for the async error event

ClaudeBox log: https://claudebox.work/s/1164aa0ab601318b?run=5

When the bb helper process crashes, the socket was destroyed but not
nulled. This meant subsequent calls to call() would pass the null
check and attempt to write to a destroyed socket. While existing
error handlers would eventually reject the callbacks, nulling the
socket reference makes the guard clause catch dead sockets immediately.
@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 3, 2026
@ludamad ludamad marked this pull request as ready for review April 3, 2026 20:51
@ludamad ludamad changed the base branch from next to merge-train/barretenberg April 3, 2026 20:52
@ludamad ludamad enabled auto-merge April 3, 2026 20:52
@ludamad ludamad merged commit 45ebe6b into merge-train/barretenberg Apr 3, 2026
57 of 65 checks passed
@ludamad ludamad deleted the claudebox/1164aa0ab601318b-5 branch April 3, 2026 21:09
github-merge-queue Bot pushed a commit that referenced this pull request Apr 4, 2026
BEGIN_COMMIT_OVERRIDE
chore: upgrade uintx assert to run in release (#22289)
chore: Fix log statement in ECDSA test (#22285)
fix: avoid oob access in RAM / ROM and enable soft-fail (#22301)
fix: restore test execution in ci-barretenberg CI modes (#22303)
fix: minor fixes pt. 5 (#22306)
chore: comment about standard behavior for de bruijn (#22310)
fix: null socket on bb process exit/error in native_socket.ts (#22309)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants