-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Description
- Version: v8.1.2
- Platform: Linux weekens-laptop 4.4.0-79-generic Revert "path: resolve normalize drive letter to lower case" #100-Ubuntu SMP Wed May 17 19:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: net
I have a test that involves net.Server socket handle transferring functionality (the socket is passed to a forked process). What the test does is:
- Creates a TCP server listening on port 8889.
- Creates a forked process.
- Passes a created TCP server handle to a forked process. The process listens for the 'connection' event on received handle. Upon connection it sends a 'Hello!' message to a connected socket and closes the connection.
- Connects with a TCP client to port 8889 and awaits data.
- Ensures that the data is 'Hello!', closes the server and kills forked process.
The test fails quite often in an interesting way: a client receives a 'connect' callback, but the forked process does not receive a 'connection' callback, and the test fails with timeout.
I have extracted all my project-related stuff from that test and came up with this small project that reproduces the issue: https://github.com/weekens/nodejs-handle-issue
You can launch the test with the following:
npm install
npm test
The test is repeated 100 times, but on my machine few single launches are enough to reproduce the issue.
The tests produce debug ouput to make it more clear what's happening there.
If I'm doing something wrong in this test - please let me know.