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

Fix ip-sticky example hanging #11

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

JaoodxD
Copy link
Contributor

@JaoodxD JaoodxD commented Nov 15, 2023

To prevent master process reading from socket which cause hanging we have to pause connection and manually resume when child_process will be ready to process it.

Mentions in Node.js documentation here net.createServer

If pauseOnConnect is set to true, then the socket associated with each incoming connection will be
paused, and no data will be read from its handle. This allows connections to be passed between
processes without any data being read by the original process.
To begin reading data from a paused socket, call socket.resume().

The issue resolved with a help of following issue: nodejs/node#13435

To prevent master process reading from socket which cause hanging we have to pause connection and manualy resume when child_process will be ready to process it.

Mentions in Node.js documentation here [net.createSerer](https://nodejs.org/api/net.html#netcreateserveroptions-connectionlistener)
```
If pauseOnConnect is set to true, then the socket associated with each incoming connection will be paused, and no data will be read from its handle. This allows connections to be passed between processes without any data being read by the original process. To begin reading data from a paused socket, call socket.resume().  
```

The issue resolved with a help of following issue: nodejs/node#13435
Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! @JaoodxD Looks like the code is outdated. It worked before, but probably not always reliable. We didn’t have a load test to check reliability and bug may be floating. According to the documentation, it looks like the flag is needed.

@tshemsedinov tshemsedinov merged commit 9c69cb2 into HowProgrammingWorks:master Nov 15, 2023
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

Successfully merging this pull request may close these issues.

2 participants