Skip to content

Conversation

@joyeecheung
Copy link
Member

The message sent using process.send() goes through JSON
serialization and parsing, which could lead to surprising behaviors.
This commit elaborate a bit more on this and add a link to
the notes about these caveats in the ECMAScript specification.

Refs: #12497

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc, process, child_process

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label May 11, 2017
@joyeecheung joyeecheung force-pushed the process-send-caveat branch from 8a3b2e1 to 6e47903 Compare May 11, 2017 05:43
@joyeecheung joyeecheung added child_process Issues and PRs related to the child_process subsystem. process Issues and PRs related to the process subsystem. labels May 11, 2017
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps simplify the link and adjust some of the wording here... for example:

*Note*: since the message is transmitted as JSON, not all values may be transferred as-is. See the documentation for [`JSON.stringify()`][] for more details.

Where the JSON.stringify() link goes to MDN instead (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description), which IMHO has a more readable description of when/how values are converted.

Copy link
Member Author

@joyeecheung joyeecheung May 11, 2017

Choose a reason for hiding this comment

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

The MDN documentation doesn't mention the Nan/Infinity -> null thing which I think is one of the surprising behaviors..the link is not about the serialization process, but rather, the caveats, which are described in the notes of the ECMA spec (although I cannot find a direct anchor to those notes, so I use the link to the method instead).

Copy link
Member Author

Choose a reason for hiding this comment

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

Also the MDN documentation doesn't mention the circular reference error...:/ hmm

Copy link
Member

Choose a reason for hiding this comment

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

Nit: The comma after sent should be a period. See notes at... can be its own sentence.

Copy link
Contributor

@mscdex mscdex May 11, 2017

Choose a reason for hiding this comment

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

I would just use the exact same text as suggested above for this part.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: this -> This

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: since -> Since

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: this -> This

Copy link
Member

Choose a reason for hiding this comment

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

Identical nit as above about comma and see notes.

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

I think the existing messaging (Note: this function uses [JSON.stringify()][] internally to serialize the message.) is good. The message should probably be moved to a better location in the send() docs though.

I don't think we should explain too much about how stringify() works, when we are linking to it already.

Copy link
Contributor

Choose a reason for hiding this comment

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

JSON.stringify() is already in this list of links in both of these files.

Copy link
Contributor

Choose a reason for hiding this comment

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

please keep the refs sorted

@BridgeAR
Copy link
Member

Ping @joyeecheung this needs a rebase and the comments still need to be addressed

@Trott
Copy link
Member

Trott commented Aug 27, 2017

Ping @joyeecheung this needs a rebase and the comments still need to be addressed

@joyeecheung I'm happy to push a commit for fixes for my nits if you'd like. Just let me know.

@BridgeAR
Copy link
Member

Ping @Trott do you want to follow up on this? I would otherwise close this.

The message sent using process.send() goes through JSON
serialization and parsing, which could lead to surprising behaviors.
This commit elaborate a bit more on this and add a link to
the notes about these caveats in the ECMAScript specification.
@Trott Trott force-pushed the process-send-caveat branch from 6e47903 to 9d99868 Compare September 20, 2017 02:57
@Trott
Copy link
Member

Trott commented Sep 20, 2017

Ping @Trott do you want to follow up on this? I would otherwise close this.

I rebased, resolved conflicts, fixed all nits, and pushed back up to Joyee's branch. I think this is ready to land.

@cjihrig Can you review and clear your request for changes if this addresses your concerns? I'm not sure if the new wording I settled on is OK by you or not.

@joyeecheung Can you review and confirm that what I've done here meets your intentions?

@nodejs/documentation PTAL

@BridgeAR
Copy link
Member

Landed in ba5a668

(I felt free to land this due to no response from @joyeecheung since a month)

@BridgeAR BridgeAR closed this Sep 22, 2017
BridgeAR pushed a commit that referenced this pull request Sep 22, 2017
The message sent using process.send() goes through JSON
serialization and parsing, which could lead to surprising behaviors.
This commit elaborate a bit more on this and add a link to
the notes about these caveats in the ECMAScript specification.

PR-URL: #12963
Refs: #12497
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
addaleax pushed a commit to addaleax/ayo that referenced this pull request Sep 23, 2017
The message sent using process.send() goes through JSON
serialization and parsing, which could lead to surprising behaviors.
This commit elaborate a bit more on this and add a link to
the notes about these caveats in the ECMAScript specification.

PR-URL: nodejs/node#12963
Refs: nodejs/node#12497
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
jasnell pushed a commit that referenced this pull request Sep 25, 2017
The message sent using process.send() goes through JSON
serialization and parsing, which could lead to surprising behaviors.
This commit elaborate a bit more on this and add a link to
the notes about these caveats in the ECMAScript specification.

PR-URL: #12963
Refs: #12497
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Sep 29, 2017
The message sent using process.send() goes through JSON
serialization and parsing, which could lead to surprising behaviors.
This commit elaborate a bit more on this and add a link to
the notes about these caveats in the ECMAScript specification.

PR-URL: #12963
Refs: #12497
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants