Why and How does Mqtt makes the workflow execution stuck which caused to the whole N8N crashed

I use N8N mqtt node to send message which to remote switch on a speaker.

The strange thing is, the workflow is working. However, sometimes the workflow will be stuck and keep running forever.

Moreover, once the mqtt workflow stuck, it possibly make the following workflows which executed after it also be stuck. Eventually, the whole will crashed.

It is not just for one workflow, it happens on all my mqtt workflows.

(one of them)

I want to know the reason for why it happened and how to prevent it.

Hi @vara_JoJo, welcome to the community!

I am very sorry you’re having trouble. I tried messing around with MQTT for a bit, but was unable to get my execution into the state you have described.

Can you confirm how exactly you have deployed n8n and which version of n8n you are running?

Are there any errors in your server logs when your n8n instance hangs?

@MutedJam
Sorry for unclear description, the situation is the mqtt workflows will work successful at first, but sometimes it will hangs suddenly. It is not 100% fail (happen error) for every execution.

like this

I used an old version 0.213 which happened this error.
I tried to upgrade the version to prevent it but it seems not working
my current version is 1.1.1

Here is the worker

2023-08-01T21:14:09+08:00 Start job: 2034 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4133)
2023-08-01T21:18:09+08:00 Start job: 2035 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4138)
2023-08-01T21:19:36+08:00 Start job: 2036 (Workflow ID: a1u4Mz78iz9qoWBS | Execution: 4140)
2023-08-01T21:25:09+08:00 Start job: 2038 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4148)
2023-08-01T21:33:02+08:00 Start job: 2042 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4160)
2023-08-01T21:34:09+08:00 Start job: 2043 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4162)
2023-08-01T21:37:09+08:00 Start job: 2045 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4167)
2023-08-01T21:42:42+08:00 Start job: 2050 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4177)
2023-08-01T21:44:02+08:00 Start job: 2052 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4181)
2023-08-01T21:47:09+08:00 Start job: 2055 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4187)
2023-08-01T22:49:34+08:00 Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’
2023-08-01T22:49:34+08:00 Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’
2023-08-02T04:49:34+08:00 Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’
2023-08-02T04:49:34+08:00 Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’

Start job: 2060 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4197)
Start job: 2061 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4199)
Start job: 2062 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4200)
Start job: 2063 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4201)
Start job: 2064 (Workflow ID: vaOQPgKEBaittx8m | Execution: 4203)
Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’
Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’
Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’
Failed to read public key: ENOENT: no such file or directory, open ‘/home/node/.n8n/ssh/key.pub’

Hi @vara_JoJo, thanks so much for sharing these additional details!

I tried to upgrade the version to prevent it but it seems not working
my current version is 1.1.1

So just to make sure I understand this correctly, n8n 1.1.1 is working for you in principle but the MQTT workflows are still stuck? Does this affect old executions (started before the upgrade) or new executions (started after the upgrade) as well?

Also, the Failed to read public key seems to be related to n8n’s environment functionality. Are you using this feature and do these errors correspond with your MQTT trouble (as in, do your MQTT executions run endlessly when seeing this error, or is this just a coincidence)?

Lastly, can you try fetching the JSON data for the problematic executions from https://your.n8n.host/rest/executions/4214 (using your actual hostname and the ID of one of your stuck executions)? Feel free to redact any confidential values in there, but make sure to not change the data structure itself.

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