Skip to content

fix(chainlib): reply to eth_unsubscribe instead of hanging the client#2296

Merged
nimrod-teich merged 1 commit into
mainfrom
fix/ws-unsubscribe-ack
May 20, 2026
Merged

fix(chainlib): reply to eth_unsubscribe instead of hanging the client#2296
nimrod-teich merged 1 commit into
mainfrom
fix/ws-unsubscribe-ack

Conversation

@sotskov-do

Copy link
Copy Markdown
Contributor

ConsumerWSSubscriptionManager.Unsubscribe returns (nil, nil) on success because the provider-relay stream has no synchronous ack frame to forward, which left consumer_websocket_manager writing nothing to the wire and clients waiting until their own timeout fired (~15s). Synthesize a JSON-RPC 2.0 §4.2-compliant {"jsonrpc":"2.0","id":,"result":true} frame at the websocket layer for the (nil, nil) case, echoing the caller's id verbatim via gjson.Raw to preserve string/number/null/object types.

Also cures the equivalent silent-hang on DirectWSSubscriptionManager's not-last-client and upstream-no-ack branches, which share the same (nil, nil) shape.

Verified locally: unsubscribe reply now arrives in ~2ms instead of timing out at 15s.

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • read the contribution guide
  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the main branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

ConsumerWSSubscriptionManager.Unsubscribe returns (nil, nil) on success
because the provider-relay stream has no synchronous ack frame to forward,
which left consumer_websocket_manager writing nothing to the wire and
clients waiting until their own timeout fired (~15s). Synthesize a
JSON-RPC 2.0 §4.2-compliant {"jsonrpc":"2.0","id":<caller-id>,"result":true}
frame at the websocket layer for the (nil, nil) case, echoing the caller's
id verbatim via gjson.Raw to preserve string/number/null/object types.

Also cures the equivalent silent-hang on DirectWSSubscriptionManager's
not-last-client and upstream-no-ack branches, which share the same
(nil, nil) shape.

Verified against ws://localhost:3360/ws: unsubscribe reply now arrives in
~2ms instead of timing out at 15s.
@sotskov-do sotskov-do requested a review from avitenzer May 20, 2026 10:13
@sotskov-do sotskov-do self-assigned this May 20, 2026
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.66667% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
protocol/chainlib/consumer_websocket_manager.go 41.66% 7 Missing ⚠️
Flag Coverage Δ
consensus 8.96% <ø> (ø)
protocol 34.97% <41.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol/chainlib/consumer_websocket_manager.go 2.21% <41.66%> (ø)

... and 215 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
7 files   +1   0 ❌ ±0 

Results for commit 9ea9c5e. ± Comparison against base commit 564493a.

@nimrod-teich nimrod-teich merged commit 0be0637 into main May 20, 2026
30 checks passed
@nimrod-teich nimrod-teich deleted the fix/ws-unsubscribe-ack branch May 20, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants