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: migrate from worker.suicide #3743

Merged
merged 1 commit into from Apr 26, 2016

Conversation

Projects
None yet
@evanlucas
Member

evanlucas commented Nov 10, 2015

Replace it with worker.exitedAfterDisconnect. Print deprecation message when
getting or setting until it is removed.

Ref: #3721

@MylesBorins

This comment has been minimized.

Member

MylesBorins commented Nov 10, 2015

LGTM

@MylesBorins

This comment has been minimized.

Member

MylesBorins commented Nov 10, 2015

Test suite passes locally fwiw

@JungMinu

View changes

doc/api/cluster.markdown Outdated
if (worker.suicide === true) {
console.log('Oh, it was just suicide\' – no need to worry').
if (worker.voluntaryExit === true) {
console.log('Oh, it was just voluntary\' – no need to worry').

This comment has been minimized.

@JungMinu

JungMinu Nov 10, 2015

Member

please add exit, it was just voluntary -> it was just voluntary exit

@JungMinu

This comment has been minimized.

Member

JungMinu commented Nov 10, 2015

LGTM with one comment

@mikeal

This comment has been minimized.

Member

mikeal commented Nov 10, 2015

"deprecate" is the wrong term here since you are ensuring exisiting compatibility. maybe "migrating" instead?

@mikeal

This comment has been minimized.

Member

mikeal commented Nov 10, 2015

also, maybe not print the deprecation warning until the next major release.

@@ -427,8 +442,8 @@ function masterInit() {
queryServer(worker, message);
else if (message.act === 'listening')
listening(worker, message);
else if (message.act === 'suicide')

This comment has been minimized.

@MylesBorins

MylesBorins Nov 10, 2015

Member

do you need to watch for the 'suicide' action here to guarantee compatibility?

This comment has been minimized.

@evanlucas

evanlucas Nov 10, 2015

Member

since the message should only be internal, I don't think so. Unless you or someone else feel differently about it

This comment has been minimized.

@MylesBorins

MylesBorins Nov 10, 2015

Member

makes sense to me 😄

@evanlucas evanlucas force-pushed the evanlucas:voluntary branch Nov 10, 2015

@jasnell

This comment has been minimized.

Member

jasnell commented Nov 10, 2015

LGTM but we need to be clear about the impact of this, however. It is quite likely a semver-major change (any time we talk about changing event names and deprecating existing terms we likely have to consider it a semver-major). That means getting a deprecation notice into v5 first, then not landing the actual change until v6.

@mikeal

This comment has been minimized.

Member

mikeal commented Nov 10, 2015

@jasnell if it's backwards compatible why would it be a semver-major change?

@jasnell

This comment has been minimized.

Member

jasnell commented Nov 10, 2015

I said "likely" ;-). The one part of this change that is potentially not backwards compatible is the event that's being triggered (https://github.com/nodejs/node/pull/3743/files#diff-0faa53fc02580d5de2ebb484c41d691cR696). Specifically, are we reasonably certain that this isn't breaking?

@Qard

This comment has been minimized.

Member

Qard commented Nov 10, 2015

A more boolean terminology like exitedVoluntarily might be a bit better. I could see someone thinking voluntaryExit is a function name.

@evanlucas

This comment has been minimized.

Member

evanlucas commented Nov 10, 2015

@jasnell I believe that those messages are only sent to/from a cluster by the cluster and workers.

@jasnell

This comment has been minimized.

Member

jasnell commented Nov 10, 2015

Ok. If we're reasonably sure that it's not breaking, I'm good with semver-minor.

@evanlucas

This comment has been minimized.

Member

evanlucas commented Nov 10, 2015

@Qard I'm fine with either. If you feel strongly about it, I will change it

@dandean

View changes

lib/cluster.js Outdated
return this.voluntaryExit;
},
set: function(val) {
// TODO: Print deprecation message.

This comment has been minimized.

@dandean

dandean Nov 10, 2015

Should this message include information about when (date or version) to expect deprecation to become removal?

This comment has been minimized.

@mikeal

mikeal Nov 10, 2015

Member

Should be slated for a major version. Honestly, we should just merge this and then open another PR right away with the deprecation warning since master is v6.

This comment has been minimized.

@evanlucas

evanlucas Nov 10, 2015

Member

Should I just add a second commit? That way we can cherry-pick the first over to v5 and not the actual deprecation?

This comment has been minimized.

@mikeal

mikeal Nov 10, 2015

Member

yes :)

@Fishrock123

View changes

lib/cluster.js Outdated
// TODO: Print deprecation message.
this.voluntaryExit = val;
}
});

This comment has been minimized.

@Fishrock123

Fishrock123 Nov 10, 2015

Member

Note: it's possible this could break if people are trying to enumerate the values of a worker object. I remember this happening with something http, though I think it will be less likely here.

@Fishrock123

View changes

doc/api/cluster.markdown Outdated
disconnection.
### worker.suicide
### worker.voluntaryExit

This comment has been minimized.

@Fishrock123

Fishrock123 Nov 10, 2015

Member

At least for the short term, we should probably note that this used to be called suicide, just so people don't get confused who may have been using it.

(If we are landing in v5 or v4)

This comment has been minimized.

@mikeal

mikeal Nov 10, 2015

Member

would it best to put ### worker.voluntaryExit (formerly worker.suicide)?

@Fishrock123

This comment has been minimized.

Member

Fishrock123 commented Nov 10, 2015

@ChALkeR I know you didn't feel for it, but could you run some npm analysis on the usage of this API if possible?

(Also cc @chrisdickinson)

@Fishrock123

This comment has been minimized.

Member

Fishrock123 commented Nov 10, 2015

As others have said I also think it may be worthwhile to think of a version of voluntaryExit that makes a little more sense as a boolean, if that's the kind of thing we want.

@evanlucas

This comment has been minimized.

Member

evanlucas commented Nov 10, 2015

Although long, if that is the way we want to go, I think exitedVoluntarily is the best

@Fishrock123

This comment has been minimized.

Member

Fishrock123 commented Nov 10, 2015

So long as we can avoid naming like exitedVoluntarilyFromWorkerProcess ala what a certain other programming language is often blamed for I think we are mostly fine.

@evanlucas evanlucas force-pushed the evanlucas:voluntary branch Nov 10, 2015

@evanlucas

This comment has been minimized.

Member

evanlucas commented Nov 10, 2015

Updated to change to exitedVoluntarily. Also includes a commit that prints a deprecation warning.

@mikeal

This comment has been minimized.

Member

mikeal commented Nov 10, 2015

hrm... I may have misspoke. since we tag the PR to automatically do the version updates we may need two PRs for the two commits since one is semver-minor and one is semver-major.

@evanlucas evanlucas changed the title from cluster: deprecate worker.suicide to cluster: migrate from worker.suicide Nov 10, 2015

@evanlucas evanlucas force-pushed the evanlucas:voluntary branch Nov 10, 2015

@addaleax

This comment has been minimized.

Member

addaleax commented Apr 25, 2016

LGTM

@@ -86,7 +90,7 @@ if (cluster.isWorker) {
// flags
assert.equal(w.state, 'disconnected', 'The state property was not set');
assert.equal(w.suicideMode, true, 'Suicide mode was not set');
assert.equal(w.voluntaryMode, true, 'Voluntary exit mode was not set');

This comment has been minimized.

@ChALkeR

ChALkeR Apr 25, 2016

Member

This file still has voluntary exit and voluntary references. It's only a test file, though.

This comment has been minimized.

@ChALkeR

ChALkeR Apr 25, 2016

Member

It'a actually fine there.

This comment has been minimized.

@evanlucas

evanlucas Apr 25, 2016

Member

ah good catch. Fixing now

@ChALkeR

This comment has been minimized.

Member

ChALkeR commented Apr 25, 2016

LGTM

1 similar comment
@MylesBorins

This comment has been minimized.

Member

MylesBorins commented Apr 25, 2016

LGTM

@Fishrock123

This comment has been minimized.

Member

Fishrock123 commented Apr 25, 2016

seems fine I suppose

@evanlucas

This comment has been minimized.

Member

evanlucas commented Apr 25, 2016

Will land later on tonight if no one objects. Thanks!!!

@Qard

This comment has been minimized.

Member

Qard commented Apr 25, 2016

LGTM. Just about anything is better than the current terminology.

@evanlucas evanlucas force-pushed the evanlucas:voluntary branch Apr 25, 2016

cluster: migrate from worker.suicide
Replace it with worker.exitedAfterDisconnect. Print deprecation
message when getting or setting until it is removed.

PR-URL: #3743
Fixes: #3721
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>

@evanlucas evanlucas force-pushed the evanlucas:voluntary branch to 4f619bd Apr 26, 2016

@evanlucas evanlucas closed this Apr 26, 2016

@evanlucas evanlucas deleted the evanlucas:voluntary branch Apr 26, 2016

@evanlucas evanlucas merged commit 4f619bd into nodejs:master Apr 26, 2016

@evanlucas

This comment has been minimized.

Member

evanlucas commented Apr 26, 2016

Landed in 4f619bd. Thanks!

jasnell added a commit that referenced this pull request Apr 26, 2016

cluster: migrate from worker.suicide
Replace it with worker.exitedAfterDisconnect. Print deprecation
message when getting or setting until it is removed.

PR-URL: #3743
Fixes: #3721
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
@Kreijstal

This comment has been minimized.

Kreijstal commented on 4f619bd Jun 5, 2016

I think that's way more verbose.

This comment has been minimized.

Member

addaleax replied Jun 5, 2016

@RainbowDangerDash That is not necessarily a bad thing (and I don’t know if you are implying that it might be); the new name is arguably better at reflecting what is actually represented by the property.

@ChALkeR

This comment has been minimized.

Member

ChALkeR commented Aug 5, 2016

Btw, this wasn't backported to 4.x, was it? Perhaps it is too late now as 4.5 already got rcs (cc @thealphanerd), but if there would be 4.6 sometime, it could make sense to backport it the other way around and without the deprecation — i.e. make .exitedAfterDisconnect a getter/setter alias to .suicide in a semver-minor version of 4.x.

@jasnell

This comment has been minimized.

Member

jasnell commented Aug 5, 2016

+1 SGTM

On Friday, August 5, 2016, Сковорода Никита Андреевич <
notifications@github.com> wrote:

Btw, this wasn't backported to 4.x, was it? Perhaps it is too late now as
4.5 already got rcs, but if there would be 4.6 sometime, it could make
sense to backport it the other way around and without the deprecation —
i.e. make .exitedAfterDisconnect a getter/setter alias to .suicide.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3743 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAa2eSlRqcZPIm26xbWiN2nT7qPSqJATks5qczxGgaJpZM4Gfr24
.

@ChALkeR

This comment has been minimized.

Member

ChALkeR commented Aug 5, 2016

Because given our LTS timeline, if we don't make 4.x support .exitedAfterDisconnect, then hard-deprecating .suicide until at least 10.x won't be reasonable, because that would force libraries to resort to detection mechanisms.

@evanlucas

This comment has been minimized.

Member

evanlucas commented Aug 5, 2016

I'll submit a backport PR today

@evanlucas evanlucas referenced this pull request Aug 6, 2016

Closed

cluster: alias suicide to exitedAfterDisconnect #7998

4 of 4 tasks complete

evanlucas added a commit to evanlucas/node that referenced this pull request Aug 7, 2016

cluster: alias suicide to exitedAfterDisconnect
This is a backport of 4f619bd which
migrates from worker.suicide to worker.exitedAfterDisconnect.

Related: nodejs#3743

jasnell added a commit that referenced this pull request Aug 12, 2016

cluster: alias suicide to exitedAfterDisconnect
This is a backport of 4f619bd which
migrates from worker.suicide to worker.exitedAfterDisconnect.

Refs: #3743
PR-URL: #7998
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

@sam-github sam-github referenced this pull request Jun 14, 2017

Closed

cluster: remove deprecated problematic API #13684

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment