Server crash

Hi, the server crashes, think it might be to do with IMAP Node.

The last log entry before the crash is below:

     throw er; // Unhandled 'error' event
:       ^
 Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
 Emitted 'error' event on ImapSimple instance at:
     at Connection.<anonymous> (/home/user/.npm-global/lib/node_modules/n8n/node_modules/imap-simple/lib/imapSimple.js:39:14)
     at Connection.emit (events.js:315:20)
    at TLSSocket._onError (/home/user/.npm-global/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:151:10)
     at TLSSocket.emit (events.js:315:20)
    at TLSSocket._emitTLSError (_tls_wrap.js:892:10)
    at JSStreamSocket.<anonymous> (_tls_wrap.js:812:36)
     at JSStreamSocket.emit (events.js:315:20)
     at Socket.<anonymous> (internal/js_stream_socket.js:58:38)

Can anyone help fix this please,
thank you,
Paul

Sorry but do not see a way how we would be able to help you here. It is sadly to vague.
Debugging a problem is only possible if there is a way to reproduce it. So please try to find out when that happens. Then write down everything which we need to know to reproduce it.
So the workflow it is happening with (the most basic version of it, so in this case I guess only the IMAP Node), what kind of email is causing it (or if it literally happens with every one), what email service you connect to, your operating system, Node.js and n8n version, and everything else you think could be helpful to know. Thanks.

1 Like

To help you focus your search, it appears as though the issue has to do with IMAP and the handling of SSL/TLS connections.

If this were me, my next step would be to see if the remote IMAP server is using a proper and updated SSL certificate.

Sorry I can’t be more specific but it is a bit of a start.

Hey. I’m experiencing the same issue. Running n8n locally using docker.

I have a pretty simple workflow, triggered with IMAP. It runs just fine when I execute. And it runs for some time before simply crashing. with the same output (mine pasted below). I’ve restarted n8n three times now and I don’t interact with it at all. It crashed every time.

The first time, I didn’t time it. The second was under 30 mins. The 3rd took about 15 minutes.

Happy to provide more details if you need.

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:456:14)
    at JSStreamSocket.doWrite (internal/js_stream_socket.js:175:19)
    at JSStream.onwrite (internal/js_stream_socket.js:33:57)
    at TLSSocket.Socket._final (net.js:419:28)
    at callFinal (internal/streams/writable.js:610:10)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ImapSimple instance at:
    at Connection.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/imap-simple/lib/imapSimple.js:39:14)
    at Connection.emit (events.js:315:20)
    at TLSSocket._onError (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:151:10)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._emitTLSError (_tls_wrap.js:888:10)
    at JSStreamSocket.<anonymous> (_tls_wrap.js:808:36)
    at JSStreamSocket.emit (events.js:315:20)
    at Socket.<anonymous> (internal/js_stream_socket.js:63:38)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (net.js:1345:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'EPIPE',
  source: 'socket'
}

EDIT: Update

I tried running the server again but changed the IMAP credentials to not use SSL. It still crashed (after ~15 minutes). The error was slightly different though:

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on ImapSimple instance at:
    at Connection.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/imap-simple/lib/imapSimple.js:39:14)
    at Connection.emit (events.js:315:20)
    at Socket._onError (/usr/local/lib/node_modules/n8n/node_modules/imap/lib/Connection.js:151:10)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read',
  source: 'socket'
}

Hey @theneilkirk!

Can you let us know which version of n8n are you using? In the recent versions, we fixed some issues with the IMAP node.

Good point @harshil1712

I hadn’t thought of that! And turns out it’s old: 1.0.7

I’ve updated to 1.125 and will try running it again!