Skip to content

Lazy socket unable to reconnect on abruptly terminated connections on Node 16 #3

Closed as not planned
@jonathansamines

Description

@jonathansamines

Hello, reporting an issue here:

Context
We indirectly depend on this package through the graphite package. As of Node 15.0.0, the client is unable to reconnect on abrupt terminations by the graphite server.

Reproduction
Fortunately, no reproduction is necessary. An existing test fails in both Node 15.0.0 and 16.0.0:

node:assert:399
    throw err;
    ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert.ok(!err)

    at /Users/jsamines/dev/personal/node-lazy-socket/test/integration/test-connection-interrupt.js:49:12
    at cbProxy (/Users/jsamines/dev/personal/node-lazy-socket/lib/LazySocket.js:37:17)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Suggested solution
Node 15 includes a number of semver-major changes to both the stream and net packages, but I suspect nodejs/node#31806 is the one causing issues here, as the error event is no longer emitted when the socket is abruptly terminated by the server. Adding an end handler seems to fix the issue, though I am not certain is the correct solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions