Skip to content

Connection pool returns terminated connections #136

Closed
@GertSallaerts

Description

@GertSallaerts

From time to time, I see this message in the logs of my app.

Error: This socket has been ended by the other party
      at Socket.writeAfterFIN [as write] (net.js:286:12)
      at NodeChannel.write (.../node_modules/neo4j-driver/lib/v1/internal/ch-node.js:254:20)
      at Chunker.flush (.../node_modules/neo4j-driver/lib/v1/internal/chunking.js:114:18)
      at Connection.sync (.../node_modules/neo4j-driver/lib/v1/internal/connector.js:488:21)
      at Session._onClose (.../node_modules/neo4j-driver/lib/v1/driver.js:163:14)
      at Session.close (.../node_modules/neo4j-driver/lib/v1/session.js:138:16)
      at .../node_modules/seraph/lib/bolt/seraph.js:191:46
      at _treatParams.then.then.catch (.../node_modules/seraph/lib/bolt/seraph.js:260:31)
      at process._tickDomainCallback (internal/process/next_tick.js:129:7)

I am able to reproduce it by following these steps:

  1. Start neo4j and my app
  2. Make a request to my app, there is now one connection in the pool
  3. Restart the neo4j database
  4. Make another request to my app

To me, it seems like the connection pool is holding on to these connections that were closed by the server, i.e. the server sent a FIN packet to the socket. I have some code that fixes the issue for me, will submit a PR momentarily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions