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

cluster: update deprecated API #13704

Closed
wants to merge 3 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jun 15, 2017

This goes along with #13702 and is part of the alternative for #13684

Mark the deprecated API non-enumerable, remove from docs, and update the deprecation message.
Technically, marking an API non-enumerable would be semver-major, but I'm proposing this as a semver-patch. The deprecated API is still there, existing code should not break as it's extremely unlikely that existing uses of the API are depending on it being enumerable.

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

cluster

@jasnell jasnell added the cluster Issues and PRs related to the cluster subsystem. label Jun 15, 2017
@jasnell jasnell mentioned this pull request Jun 15, 2017
4 tasks
@refack
Copy link
Contributor

refack commented Jun 15, 2017

If this gets push back, #13703 could be considered, as it's even less major.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

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.

LGTM, although the deprecation message may confuse people at first glance just because it doesn't say what they should be using exitedAfterDisconnect in place of (I get that is the point though).

Copy link
Contributor

@MylesBorins MylesBorins left a comment

Choose a reason for hiding this comment

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

LGTM if Ci is green

@@ -95,12 +95,18 @@ methods, the `options.customFds` option is deprecated. The `options.stdio`
option should be used instead.

<a id="DEP0007"></a>
### DEP0007: cluster worker.suicide
### DEP0007: Replace cluster worker.suicide with worker.exitedAfterDisconnect
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider removing the phrase from the error code?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately I think it's necessary for context, otherwise those seeing the deprecation error and not having any context won't really have a clue what it is about, or any ability to find out. The whole reason deprecations.md exists is to provide that context when necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

it can be a reference though right? like give you a url to check the extended documentation?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the extended documentation. This message is in deprecations.md, this is not the warning message that is printed to the console.

@ChALkeR
Copy link
Member

ChALkeR commented Jun 15, 2017

@jasnell I can't think of any noticeable negative consequnces of this spefic PR, but I am not fully convinced that the property should be entirely removed in 9.0 yet.

@@ -20,14 +19,16 @@ function Worker(options) {

this.exitedAfterDisconnect = undefined;

// This property has been deprecated and is being removed entirely
// in Node.js 9.0.0
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure yet that the correct action would be to remove the property entirely in 9.0.
Apart from this comment, this change looks fine.

Within the `cluster` module, the [`worker.suicide`][] property has been
deprecated. Please use [`worker.exitedAfterDisconnect`][] instead.
In an earlier version of the Node.js `cluster`, an unfortunate decision was
made to add a boolean property with the name `suicide` to the `Worker` object.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: an unfortunate decision was made to add a boolean property with the name -> there was a boolean property named

unfortunate appears a couple sentences later so we can remove the repetition of the word here without losing content

Copy link
Member Author

Choose a reason for hiding this comment

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

I can update that in whichever one of the PRs is landed first then cherry-pick the updated commit here.

@@ -3,8 +3,7 @@ const EventEmitter = require('events');
const internalUtil = require('internal/util');
const util = require('util');
const defineProperty = Object.defineProperty;
const suicideDeprecationMessage =
'worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.';
const deprecationMessage = 'Please use worker.exitedAfterDisconnect instead.';
Copy link
Contributor

@seishun seishun Jun 15, 2017

Choose a reason for hiding this comment

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

This will cause people to see warnings like (node:4680) DeprecationWarning: Please use worker.exitedAfterDisconnect instead., which is completely uninformative.

Copy link
Member Author

Choose a reason for hiding this comment

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

Understood, and in general I agree that it's not ideal, but this is about finding a compromise that avoids the original problem. The reason deprecation codes were added is to provide a mechanism for finding the context if necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

If someone sees the warning and decides to find the context, they'll see the word anyway. The only case where hiding it here would help is when the warning is perpetually ignored.

Copy link
Contributor

@refack refack Jun 17, 2017

Choose a reason for hiding this comment

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

It will be (node:4680) [DEP0007] DeprecationWarning: Please use worker.exitedAfterDisconnect instead. and that easily googleable.
We can't eliminate all references, but putting it one step further is good IMHO.
(at least it won't be repeated over and over in the logs)

Copy link
Contributor

Choose a reason for hiding this comment

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

It's hard for me to imagine a scenario where it would be repeated over and over in the logs, as the warning is one-time per process.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's the paradox of this whole situation... see (content warning) Unitech/pm2#2780

@jasnell jasnell force-pushed the update-deprecated-api branch 2 times, most recently from f05dbdf to 8a0f530 Compare June 15, 2017 21:29
@jasnell
Copy link
Member Author

jasnell commented Jun 15, 2017

Updated the deprecations.md text to use the wording suggested by @Trott here

@jasnell
Copy link
Member Author

jasnell commented Jun 19, 2017

ping @nodejs/ctc
Given the sign off, I'd like to get this landed by tomorrow, but want to make sure there are no objections

@jasnell
Copy link
Member Author

jasnell commented Jun 20, 2017

Updated the language in the docs a bit.

@jasnell
Copy link
Member Author

jasnell commented Jun 20, 2017

@jasnell
Copy link
Member Author

jasnell commented Jun 20, 2017

CI failure is unrelated.

jasnell added a commit that referenced this pull request Jun 20, 2017
PR-URL: #13704
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
jasnell added a commit that referenced this pull request Jun 20, 2017
PR-URL: #13704
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
jasnell added a commit that referenced this pull request Jun 20, 2017
Make deprecated property non-enumerable, remove from docs

PR-URL: #13704
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
@jasnell
Copy link
Member Author

jasnell commented Jun 20, 2017

Landed in 3d2b59f, 7007f70, and f64ea03

@jasnell jasnell closed this Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cluster Issues and PRs related to the cluster subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants