-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Child Process send incorrectly serializes values #5453
Comments
The message is stringified prior to sending using
|
This is actually according to the specification. Please see http://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify, specifically Note 4.
Closing as this is working as designed. Thanks! |
I know it's according to the json spec. But i don't think this issue should be closed. Firstly, it does not specify in the documentation for process that it uses json stringify for data transfer. Secondly, there are other ways to serialise data that wouldn't suffer from this. |
@jacobp100 Fair enough. At this point, changing the way serialization between processes is done would be a pretty large undertaking. I do recall that it has been considered though. For now, I think that a doc update would suffice. Would you be willing to submit a Pull Request with that update? Thanks! |
The documentation does mention in a few places that JSON is used but I agree it could be more explicit, particularly the reference documentation for
Sure, but we're not using that, have never used that in the past and I don't think this particular issue is important enough to merit writing a high-performance serializer/deserializer from scratch. That's without even getting into the issue of backwards compatibility. |
@jacobp100 do you plan to submit a PR for a doc update ? If no, I'm volunteer to do it as I'm interested in this. |
Go for it! |
Explicitly call out that the send method on both process and child uses JSON.stringify to serialize the message Fixes nodejs#5453
Hi @abenhamdine , I am a Ph.D. student. I am doing research about helping newcomers participate in OSS projects. I noticed that many projects are using labels such as 'good first issue/bug, difficulty/newcomer' for issues to recommend that newcomers start from these tasks. I noticed that you tried to solve this issue, but unfortunately, you had not contributed successfully. I also found there are many newcomers feel difficult when submitting their first pr. Therefore, I want to optimize this mechanism, which needs your help. I have some questions and wish your valuable feedback.
I am looking forward to hearing from you soon. Thank you very much!
|
very interesting research !
No pb, the OP wanted to send a PR so finally I didn't handle the PR.
It was a doc issues and it's easier for newcomers to handle doc updates than actually modify the code.
Yes, its a common practice to attach "good first issue" to issues, in many popular repositories
|
Code
index.js
worker.js
Expected Result
Actual Result
node -v
v5.6.0
uname -a
output, or if Windows, version and 32-bit or64-bit
Linux tido-tchaikovsky 3.19.0-51-generic #57~14.04.1-Ubuntu SMP Fri Feb 19 14:36:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
child_process
The text was updated successfully, but these errors were encountered: