2

I'm using a node client library for LogEntries, and it uses a simple socket connection to interact with its service.

var socket = net.createConnection(options.port, options.host);

After a certain period of time of the instance of the connection living in memory, the client lib starts to emit these errors:

Error: read ECONNRESET at errnoException (net.js:904:11) at TCP.onread (net.js:558:19)

What does this mean? Does it mean that LogEntries is closing the connection after a certain amount of time?

Also, does the connection automatically reestablish the connection once it is lost?

Perhaps I shouldn't be retrying to use the client and just init a new one each time I want to use it? This would ensure the timeout is never reached.

1 Answer 1

4

I've discovered a solution.

From my research, Error: read ECONNRESET can mean that the remote host, in my case LogEntries, closed the connection.

This was happening because I built the LogEntries to be a singleton that lived in memory forever to avoid spinning up a new client instance each time it needed to be used. This caused a socket connection to LogEntries to remain open for long periods of times, thus triggering the socket error.

The solution was refactor the code so that the client is created more frequently, avoiding the socket remaining open for an extended period of time.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.