Repository navigation
fix: pass the node to checkRpcLock instead of an undefined self - #18
Merged
Merged
Conversation
added 2 commits
November 27, 2026 15:11
checkRpcLock is a module-level function, yet it reset the chain filter state through 'self', which only exists inside Node methods. Whenever a slow node kept the RPC lock past RPC_LOCK_TIMEOUT, the agent threw 'ReferenceError: self is not defined', exited 1 and PM2 restarted it: 2035 restarts on zq2-mainnet-api-ase1-0 between 2026-11-20 and 11-27. Adds a node:test regression test and an npm test script.
v2 of ci-dockerized-app-build-push pulls configure-aws-profile@main, which DEVOPS-228 (cubedro#84) removed, so every image build fails before it starts. v4 takes the same inputs.
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.
Problem
checkRpcLock()is a module-level function, yet when the RPC lock times out it resets the chain filter state throughself, which only exists insideNodemethods. Whenever the monitored node is slow enough to keep the lock pastRPC_LOCK_TIMEOUT(10 s), the agent throwsReferenceError: self is not definedatlib/node.js:171, exits 1 and PM2 restarts it.On
zq2-mainnet-api-ase1-0that is 2035 restarts between 2026-11-20 and 2026-11-27, peaking at 758 and 783 per day during the 11-24/25 API slowdown.Fix
Pass the
Nodeinstance intocheckRpcLock(node)at all four call sites.Tests
test/rpc-lock.test.js(npm test, built-innode:test, no new dependency) loadslib/node.jsin a vm context with stubbed dependencies and a fake clock, engages the lock and lets it time out. Before the fix it fails with the productionReferenceError; after the fix it passes and the node's chain filter state is reset.