If MQTT Trigger is launched, I see errors in the logs, the UI gives a startup error, but if you reload the workflow page, it seems to work. In case I reboot my n8n and workflow that come after workflow with mqtt trigger are not loaded…
This function has definitely worked correctly before.
What is the error message (if any)?
(node:8) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [MqttClient]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
n8n version: n8nio/n8n:1.8.2
Database (default: SQLite): PostgreSQL
n8n EXECUTIONS_PROCESS setting (default: own, main): main
Running n8n via (Docker, npm, n8n cloud, desktop app): docker
(node:8) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [MqttClient]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
Hi @a1ekseev, I am very sorry you are having trouble.
This error isn’t related to a specific workflow unfortunately, with the node:8 suggesting it’s somewhere inside of Node.js itself. Your workflow itself doesn’t look problematic (of course not, it’s merely a trigger node).
Perhaps you can test whether this is caused by n8n starting before your MQTT broker is listening?
Also, can you confirm which problem exactly you are seeing in the UI?
No, the docker-compose example that I gave is just to understand my configuration, yes, there is not enough depends_on, but in the full configuration it is taken into account.
But even if we restart workflow, we still get the same errors.
The criticality is that if I restart n8n, the workflows that start after the problematic one do not start.
Hi @a1ekseev, I was able to reproduce your problem and have added this to our bug tracker for a closer look and fix. We will of course update this thread once a fix is available.
Please accept my sincere apologies for the trouble.
I’ve same issue with MQTT trigger. I’ve tried a number of different n8n docker image tags from 1.8.2 thru 1.11.1, and I haven’t found one that works without that error message.
Not sure if it’s related, but…when I send topic message to MQTT once, in n8n, I’ll find some 40 executions listed. A third of them will show as Succedded, but the majority will show as Running and they never timeout even though I have a 10 second timeout set for the workflow.
Is it possible the workflow isn’t unsubscribing from the MQTT topic correctly when made inactive or manual listen is over? Is it somehow ending up getting multiple messages from MQTT each time and therefore spawning many executions?
I just tried changing my topic names, and the problem seems to be gone for now.
I found out more information.
Setup:
Disable workflow
Reboot server
Change the mqtt trigger topic to something completely new to avoid old mqtt subscriptions.
Activate workflow.
Send mqtt message to the new topic from another tool.
Results:
I see one execution for one message as exected. Activating and deactivating the workflow back and forth does not break it.
To break it:
Use the “Execute Workflow” button to run a test in the n8n interface, and trigger it. One execution will occur as expected. However, all future non-manual triggers will have many executions. In fact, I think the longer I sit in the manual execution mode without receiving a trigger. The larger the number of non-manual executions will occur.
I’m suspecting that during Execute Workflow for the manual test, it is sending subscription requests over and over again, without unsubscribing between. If I sit in that state waiting for a trigger for a long time, a large number of mqtt subscriptions seem to be entered and then mqtt is sending all those publications to n8n during normal operation.
By the way, I do have Clean Session toggled on in my mqtt connection settings, and I assume that’s why a server reboot is successful at ending the problem. I just can’t test the workflow without creating the issue again.
I think the issue is still there. I have a 1.15.2 version and when i launch 2-3 workflows containing mqtt triggers, nothing working and i got message : “(node:66608) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [MqttClient]. Use emitter.setMaxListeners() to increase limit”
Hi folks, just to clarify what was fixed here was a problem where workflows beyond the MQTT trigger workflow would not activate. This was the original problem:
workflow that come after workflow with mqtt trigger are not loaded
Problems with the MQTT setup might be a different story. Can you please confirm if such problems still persist with n8n 1.16.0 and if so, provide detailed steps on how to reproduce the problem in a new thread?