Problem in node ‘MySQL‘ (SSH) Channel open failure After a period

I installed n8n through cloudron and have been using it for a long time, but when changing from VPS with Backup, it seems that n8n works normally, performs its processes, but after a time on it simply starts to give error in all jobs in the part of connecting to Mysql in which I use SSH, I get the following error:

Problem in node ‘MySQL’(SSH) Channel open failure: Connection refused

The error disappears if I restart the N8N by Cloudron Repair, but after a while the error happens again, I can’t debug it.

Examining the logs I found:

2024-08-16T14:19:00.000Z Error: (SSH) Channel open failure: Connection refused
2024-08-16T14:19:00.000Z at 92 e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/handlers.misc.js:881:16e[90m)e[39m
2024-08-16T14:19:00.000Z at AESGCMDecipherBinding.decrypt e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/crypto.js:1086:26e[90m)e[39m
2024-08-16T14:19:00.000Z at CHANNEL_OPEN_FAILURE e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/client.js:572:11e[90m)e[39m
2024-08-16T14:19:00.000Z at Protocol.onPayload e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:2059:10e[90m)e[39m
2024-08-16T14:19:00.000Z at Protocol.parse e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:313:16e[90m)e[39m
2024-08-16T14:19:00.000Z at Protocol.parsePacket [as _parse] e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:2028:25e[90m)e[39m
2024-08-16T14:19:00.000Z at Socket. e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/client.js:775:21e[90m)e[39m
2024-08-16T14:19:00.000Z at onChannelOpenFailure e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/utils.js:16:11e[90m)e[39m
2024-08-16T14:19:00.000Z obfuscate: e[33mtruee[39m
2024-08-16T14:19:00.000Z reason: e[33m2e[39m,
2024-08-16T14:19:00.000Z } e[90mundefinede[39m
2024-08-16T14:19:04.000Z e[90m at Socket.emit (node:domain:489:12)e[39m {
2024-08-16T14:19:04.000Z e[90m at Socket.emit (node:events:517:28)e[39m
2024-08-16T14:19:04.000Z Error: (SSH) Channel open failure: Connection refused
2024-08-16T14:19:04.000Z at 92 e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/handlers.misc.js:881:16e[90m)e[39m
2024-08-16T14:19:04.000Z at AESGCMDecipherBinding.decrypt e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/crypto.js:1086:26e[90m)e[39m
2024-08-16T14:19:04.000Z at CHANNEL_OPEN_FAILURE e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/client.js:572:11e[90m)e[39m
2024-08-16T14:19:04.000Z at Protocol.onPayload e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:2059:10e[90m)e[39m
2024-08-16T14:19:04.000Z at Protocol.parse e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:313:16e[90m)e[39m
2024-08-16T14:19:04.000Z at Protocol.parsePacket [as _parse] e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:2028:25e[90m)e[39m
2024-08-16T14:19:04.000Z at Socket. e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/client.js:775:21e[90m)e[39m
2024-08-16T14:19:04.000Z at onChannelOpenFailure e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/utils.js:16:11e[90m)e[39m
2024-08-16T14:19:04.000Z obfuscate: e[33mtruee[39m
2024-08-16T14:19:04.000Z reason: e[33m2e[39m,
2024-08-16T14:19:04.000Z } e[90mundefinede[39m
2024-08-16T14:19:17.000Z e[90m at Socket.emit (node:domain:489:12)e[39m {
2024-08-16T14:19:17.000Z e[90m at Socket.emit (node:events:517:28)e[39m
2024-08-16T14:19:17.000Z Error: (SSH) Channel open failure: Connection refused
2024-08-16T14:19:17.000Z at 92 e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/handlers.misc.js:881:16e[90m)e[39m
2024-08-16T14:19:17.000Z at AESGCMDecipherBinding.decrypt e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/crypto.js:1086:26e[90m)e[39m
2024-08-16T14:19:17.000Z at CHANNEL_OPEN_FAILURE e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/client.js:572:11e[90m)e[39m
2024-08-16T14:19:17.000Z at Protocol.onPayload e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:2059:10e[90m)e[39m
2024-08-16T14:19:17.000Z at Protocol.parse e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:313:16e[90m)e[39m
2024-08-16T14:19:17.000Z at Protocol.parsePacket [as _parse] e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/protocol/Protocol.js:2028:25e[90m)e[39m
2024-08-16T14:19:17.000Z at Socket. e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/client.js:775:21e[90m)e[39m
2024-08-16T14:19:17.000Z at onChannelOpenFailure e[90m(/app/code/e[39mnode_modules/e[4mssh2e[24m/lib/utils.js:16:11e[90m)e[39m
2024-08-16T14:19:17.000Z obfuscate: e[33mtruee[39m
2024-08-16T14:19:17.000Z reason: e[33m2e[39m,
2024-08-16T14:19:17.000Z } e[90mundefinede[39m
2024-08-16T14:19:34.000Z e[90m at Socket.emit (node:domain:489:12)e[39m {
2024-08-16T14:19:34.000Z e[90m at Socket.emit (node:events:517:28)e[39m
2024-08-16T14:19:34.000Z Error: (SSH) Channel open failure: Connection refused

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello same error:
n8n version

1.54.4 (Self Hosted)

Stack trace

Error: (SSH) Channel open failure: Connection refused at onChannelOpenFailure (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/utils.js:16:11) at CHANNEL_OPEN_FAILURE (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:572:11) at 92 (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/handlers.misc.js:881:16) at Protocol.onPayload (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:2059:10) at AESGCMDecipherNative.decrypt (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/crypto.js:987:26) at Protocol.parsePacket [as _parse] (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:2028:25) at Protocol.parse (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:313:16) at Socket.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:775:21) at Socket.emit (node:events:519:28) at Socket.emit (node:domain:488:12)


n8n version:1.54.4
Database (default: SQLite): default
n8n EXECUTIONS_PROCESS setting (default: own, main):default
Running n8n via (Docker, npm, n8n cloud, desktop app):docker
Operating system: ubuntu

I thought I had solved it, because I installed a new n8n and it was days without giving the problem, now today it appeared again, I don’t know if it was the resize I did to increase RAM usage, decrease now to see.

It looks like the ssh connection is being refused by the container for some reason, are there any other messages in the n8n container output?

How often do the workflows run that use the ssh tunnels, it could be that we are not closing the tunnels correctly and are leaving them open or maybe there is a clash with the port and it happens when 2 mysql nodes try to run at once.

How do you close the tunnels correctly?

That would be on our side, once we have more information we can work out the best way to test.

n8n works again after a restart, up to about 50-100 SSH connections, and then everything stops working again,

Debug info

core

  • n8nVersion: 1.55.3
  • platform: docker (self-hosted)
  • nodeJsVersion: 20.15.0
  • database: sqlite
  • executionMode: regular
  • concurrency: -1
  • license: community
  • consumerId: unknown

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: memory

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

Generated at: 2024-08-23T07:48:50.859Z

Perfect, And is there anything else in the n8n log?

This is what appears in the MySQL element error log:

{
“errorMessage”: “Internal error”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.55.3 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“Error: (SSH) Channel open failure: Connection refused”,
" at onChannelOpenFailure (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/utils.js:16:11)“,
" at CHANNEL_OPEN_FAILURE (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:572:11)”,
" at 92 (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/handlers.misc.js:881:16)“,
" at Protocol.onPayload (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:2059:10)”,
" at AESGCMDecipherNative.decrypt (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/crypto.js:987:26)“,
" at Protocol.parsePacket [as _parse] (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:2028:25)”,
" at Protocol.parse (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/Protocol.js:313:16)“,
" at Socket. (/usr/local/lib/node_modules/n8n/node_modules/ssh2/lib/client.js:775:21)”,
" at Socket.emit (node:events:519:28)“,
" at Socket.emit (node:domain:488:12)”
]
}
}

1 Like

I’m experiencing the same issue. Did anyone find a solution in the meantime?

1 Like

Just ran into this issue on 1.64.3, I just restart n8n and it fixes it momentarily. Running ulimit -n shows I have 1024 set. Is there any fix to this?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.