JohnSColeman opened a new pull request, #10:
URL: https://github.com/apache/ignite-nodejs-thin-client/pull/10

   ## Summary
   
   - **ClientSocket: serialize concurrent `data` event processing** — the 
`data` handler was `async` but Node.js does not await async event listeners 
before firing the next event. Under parallel scan workloads, a second TCP frame 
could arrive while `_processResponse` was suspended at `await 
_finalizeResponse`, corrupting shared `_buffer`/`_offset` state. Fixed by 
chaining each invocation onto a `_processingQueue` promise 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 `while` loop read 
the second message's length from `buffer.position` (wherever the previous 
payloadReader left it) rather than from `this._offset` (the actual start of the 
second message). Fixed by resetting `buffer.position = this._offset` at 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 
`MessageBuffer` object. When they concurrently called `_read()` under 
`Promise.all`, they shared the single `_position` field and interleaved reads 
at wrong offsets. Fixed by carving a fresh independent 
`MessageBuffer.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** — 
`_hasNext` starts as `false` and `_values` starts as `null`, so `hasMore()` 
incorrectly returned `false` before the first `_getValues()` call. Fixed by 
also returning `true` when `_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 
with `Cannot read properties of null`. Fixed with a null-guard that sets 
`_values = null` instead.
   
   - **Errors: fix `BinaryUtils.getTypeName is not a function`** — `Errors.ts` 
used bare `require('./internal/BinaryUtils')` which, for an `export default 
class`, returns the module namespace object rather than the class. Fixed by 
adding `.default` to all three require calls.
   
   ## Test plan
   
   - All 103 tests in `npm test` pass against a live Ignite 2.15 instance
   - Scan query suite (`spec/query/ScanQuery.spec.js`) passes including 
multi-page cursor iteration
   - Cache key/value suite passes including put/get of all primitive and 
complex types
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to