Fix four bugs in ClientSocket, Cursor and Errors#10
Open
JohnSColeman wants to merge 1 commit intoapache:masterfrom
Open
Fix four bugs in ClientSocket, Cursor and Errors#10JohnSColeman wants to merge 1 commit intoapache:masterfrom
JohnSColeman wants to merge 1 commit intoapache:masterfrom
Conversation
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
ClientSocket: serialize concurrent
dataevent processing — thedatahandler wasasyncbut Node.js does not await async event listeners before firing the next event. Under parallel scan workloads, a second TCP frame could arrive while_processResponsewas suspended atawait _finalizeResponse, corrupting shared_buffer/_offsetstate. Fixed by chaining each invocation onto a_processingQueuepromise so frames are always processed serially.ClientSocket: fix per-message buffer position tracking — when two complete Ignite messages arrive in a single TCP segment, the
whileloop read the second message's length frombuffer.position(wherever the previous payloadReader left it) rather than fromthis._offset(the actual start of the second message). Fixed by resettingbuffer.position = this._offsetat the top of each loop iteration.ClientSocket: fix cursor MessageBuffer aliasing — two cursors created from the same TCP segment were both handed a reference to the same
MessageBufferobject. When they concurrently called_read()underPromise.all, they shared the single_positionfield and interleaved reads at wrong offsets. Fixed by carving a fresh independentMessageBuffer.from(slice)copy for each message's payload before passing it to_finalizeResponse.ClientSocket: silently discard unsolicited server notification frames — Ignite 2.14+ sends topology-change and heartbeat frames with IDs that do not match any pending client request. The original code had no handler for this case; the missing branch caused a crash. Fixed by logging and discarding such frames.
Cursor: fix
hasMore()returning false on a freshly-opened cursor —_hasNextstarts asfalseand_valuesstarts asnull, sohasMore()incorrectly returnedfalsebefore the first_getValues()call. Fixed by also returningtruewhen_buffer != null(the initial scan page is buffered at construction time).Cursor: fix
_getValues()null-buffer crash on cursor exhaustion — after the last page was read,_getValues()called_read(null)which crashed withCannot read properties of null. Fixed with a null-guard that sets_values = nullinstead.Errors: fix
BinaryUtils.getTypeName is not a function—Errors.tsused barerequire('./internal/BinaryUtils')which, for anexport default class, returns the module namespace object rather than the class. Fixed by adding.defaultto all three require calls.Test plan
npm testpass against a live Ignite 2.15 instancespec/query/ScanQuery.spec.js) passes including multi-page cursor iteration🤖 Generated with Claude Code