Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node red not reacting when more than three gpiox-in #1

Closed
mhin76 opened this issue Jun 14, 2024 · 9 comments
Closed

node red not reacting when more than three gpiox-in #1

mhin76 opened this issue Jun 14, 2024 · 9 comments

Comments

@mhin76
Copy link

mhin76 commented Jun 14, 2024

I noticed, that when I use three gpiox-in all works just fine (in addition I use several gpiox.out).
but as soon as I add another gpiox-in, nodered hangs on the second deployment! Means, first deployment all fine, when I change anything in node red and I want to reploy it is not reacting anymore and I have to kill the node red session, set that flow to disabled via flows.json file and restart node red again.
I do not see any message on node red debugging (on info level).

is there a max on those listener? any idea how I could further debug?

PS: I am using raspberry 4 with bookworm

@iiot2k
Copy link
Owner

iiot2k commented Jul 7, 2024

Hello,
sorry for the late reply.
That is really very interesting.
Thank you for your tip.
I'll try to recreate it.
Can you also tell me the version of the OS, node.js and Node-Red?
Best regards
Viele Grüße
Derya

@mhin76
Copy link
Author

mhin76 commented Jul 8, 2024

I run bookworm (Linux kernel 6.6.31) on a RP5 with NodeRed v3.1.9 and node.js v20.15.0.
Sonnige Grüsse, Martin

@iiot2k
Copy link
Owner

iiot2k commented Jul 8, 2024

Hi Martin,
can you send me your Node-Red Flow to my e-mail address ?
Thanks!
Viele Grüße
Derya

@FlamingFury321
Copy link

I have the same issue.
The selected pin doesn't matter but as soon as I enable the 4th GPIO Node (even when not connected) it hangs and i cannot deploy anything anymore. After 30 seconds I get an "Error: connect ETIMEDOUT" error on one of my mysql nodes (even though it isn't connected in any way to the GPIO node).
LG Daniel

@mhin76
Copy link
Author

mhin76 commented Jul 9, 2024

yes, exactly same behavior. I have then to disable that flow via nano flows.json and restart node red to get in again. Attached my flow.
flows (3).json

those 5 at the bottom I tried to enable. Three of them I kept disabled.

No hurry about the fix. for me not so urgent at least :)

@mhin76
Copy link
Author

mhin76 commented Jul 9, 2024 via email

@iiot2k
Copy link
Owner

iiot2k commented Jul 15, 2024

Hello,
the problem is UV_THREADPOOL_SIZE in node.js.
This value is set to 4 by default.
That's why you can't call any more watches.
You can set this environment variable up to 1024, but that's not the solution.
I'll probably have to rewrite the code.

Here is the issue:
nodejs/node-addon-api#1539

Best regards
Derya

@iiot2k
Copy link
Owner

iiot2k commented Jul 17, 2024

Fix watch_gpio 🐛

The watch_gpio function only accepts a few gpio watches.

The reason is that the gpio watches run in the background as a thread.

Unfortunately, the maximum number of threads is set to 4.

One solution is to increase this number of threads.

With the command:

export UV_THREADPOOL_SIZE=1000

You can increase this number of threads (max. 1024) for node.js.

Of course, this number of threads also increases the memory requirement.

Try other numbers of threads too.

This also applies to the Node-Red node.

All other functions work correctly.

@iiot2k
Copy link
Owner

iiot2k commented Jul 18, 2024

Solved with Version 2.1.3
Thanks to all who helped.

@iiot2k iiot2k closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants