test(websocket): add tests reproducing 1005 reconnect loop failover bug#703
Draft
cl-efornaciari wants to merge 1 commit intomainfrom
Draft
test(websocket): add tests reproducing 1005 reconnect loop failover bug#703cl-efornaciari wants to merge 1 commit intomainfrom
cl-efornaciari wants to merge 1 commit intomainfrom
Conversation
Add 3 tests demonstrating how the connectionOpenedAt reset defeats the failover counter when WebSocket connections are rapidly closed externally (code 1005), trapping the EA on the same failing URL indefinitely. - Test 1: failover counter stays at 0 during rapid 1005 close/reconnect - Test 2: control test showing counter increments for open-but-unresponsive - Test 3: end-to-end showing EA stalls and stops serving prices
Contributor
NPM Publishing labels 🏷️🛑 This PR needs labels to indicate how to increase the current package version in the automated workflows. Please add one of the following labels: |
4 tasks
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
test/transports/websocket.test.tsthat reproduce the WebSocket 1005 reconnect loop bug whereconnectionOpenedAtresets on each reconnect, defeating the failover counterstreamHandlerInvocationsWithNoConnection) stays at 0 becausetimeSinceConnectionOpenedresets on each reconnect, never exceedingWS_SUBSCRIPTION_UNRESPONSIVE_TTLRoot Cause
The
connectionOpenedAttimestamp inWebSocketTransport.streamHandleris reset toDate.now()on every successful reconnect (line 440 ofwebsocket.ts). TheconnectionUnresponsivecheck usesMath.min(timeSinceLastMessage, timeSinceConnectionOpened), so in a rapid close/reconnect cycle,timeSinceConnectionOpened(~5s per cycle) always dominates and never exceedsWS_SUBSCRIPTION_UNRESPONSIVE_TTL(default 120s). This prevents the failover counter from incrementing, keepingwsSelectUrllocked on the failing primary URL.This was introduced in framework PR #614 (the URL failover mechanism) and affects all Tiingo adapter versions from 2.9.0 onward. See
rca-tiingo-ws-1005.mdfor the full RCA with version mapping.Test plan
Made with Cursor