-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
"Error: write EBADF" when sending a TLSSocket to the parent process #4037
Comments
You can't do that (sending TLS sockets to another process, that is.) The TLS state machine can't be transferred to another process. |
Is it advisable to get the unencrypted socket out of it before sending it to the parent (I guess not)? Or is there another way to leave the encryption wrapper in the child. Maybe signal the parent from the child and let the parent create a new net.Socket that can be sent/piped to the child? |
You can do either but in the second scenario the parent process can become a bottleneck because that's where all encryption/decryption takes place. |
I like to leave most code it in the unprivileged child, so in this case the one holding OpenSSL etc. But either way, one process should hold a net.Socket and the other one the tls.TLSSocket and then the net.Socket can be shared between processes and piped, right? |
That will work, yes. |
thanks! |
The official is no better solution for it |
When sending a tls.TLSSocket to the parent process, the parent crashes with the following message: "Error: write EBADF".
Steps to reproduce:
$ cat bug_parent.js
$ cat bug_child.js
$ cat bug_client.js
Start the server in a terminal.
$ node bug_parent.js
Now start the client in another terminal.
$ node bug_client.js
Server terminal prints:
Tested with Node 5.1.0, the problem exists in Node 4.2.2 as well, albeit with a different message: "listener must be a function". It all works when requiring
net
instead oftls
.The text was updated successfully, but these errors were encountered: