You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the current code for the daemon does not close the connect file descriptors (newsockfd). in an application where there are a large number of accepts to be made, the daemon eventually terminates when no more file descriptors are available. this is the case, as an example, in an application where the server would run a cron job every minute to automatically switch sockets.
fix: as you do not need the fork threads for this to work, switch the sockets in the while loop (not in a separate thread) and close newsockfd at the bottom of the while loop.
you can check whether you have a fd problem with the following commands:
ps -ax | grep daemon # daemon must be your executable file name
lsof -p # the pid you received with the previous command
The text was updated successfully, but these errors were encountered:
I am working on a rework from scratch of the whole daemon. I will send a pull request when it's done. There are some more bugs (crash while receiving malformed data, no longer working delay) and (for me) missing features like binary addressing.
still i'd recommend looking at the powerswitch branch first.
konni
July 14 2015 6:37 PM, "devzero84" wrote:
I am working on a rework from scratch of the whole daemon. I will send a pull request when it's done. There are some more bugs (crash while receiving malformed data, no longer working delay) and (for me) missing features like binary addressing.
—
Reply to this email directly or view it on GitHub (#5 (comment)).
the current code for the daemon does not close the connect file descriptors (newsockfd). in an application where there are a large number of accepts to be made, the daemon eventually terminates when no more file descriptors are available. this is the case, as an example, in an application where the server would run a cron job every minute to automatically switch sockets.
fix: as you do not need the fork threads for this to work, switch the sockets in the while loop (not in a separate thread) and close newsockfd at the bottom of the while loop.
you can check whether you have a fd problem with the following commands:
ps -ax | grep daemon # daemon must be your executable file name
lsof -p # the pid you received with the previous command
The text was updated successfully, but these errors were encountered: