GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cluster: wait for all servers closing before disconnect by Olegas · Pull Request #1400 · nodejs/node

Conversation

@Olegas

@Olegas Olegas commented Apr 11, 2015

Copy link
Copy Markdown
Contributor

Fix for #1305
Before this, cluster bahaves not the way it is docummented
Then disconnect is triggered, worker must wait for every server is closed
before doing disconnect actually.

See test case and discussion in the above mentioned issue

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Olegas

Olegas commented Apr 11, 2015

Copy link
Copy Markdown
Contributor Author

/cc @bnoordhuis

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mscdex mscdex added the cluster Issues and PRs related to the cluster subsystem. label Apr 11, 2015
brendanashworth
brendanashworth reviewed Apr 11, 2015
View reviewed changes
Comment thread test/parallel/test-cluster-worker-wait-server-close-schedrr.js Outdated

@brendanashworth brendanashworth Apr 11, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Could you change 127.0.0.1 to common.localhostIPv4?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Olegas

Olegas commented Apr 11, 2015

Copy link
Copy Markdown
Contributor Author

@brendanashworth done

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig reviewed Apr 13, 2015
View reviewed changes
Comment thread lib/cluster.js Outdated

@cjihrig cjihrig Apr 13, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Can you please use a more descriptive name. Maybe checkRemainingHandles.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Olegas

Olegas commented Apr 13, 2015

Copy link
Copy Markdown
Contributor Author

@cjihrig tests are the same, except scheduling policy. But there are note in the ...schedrr test. I don't think it is a bug, but it is a consequence of SHCED_RR implementation.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson chrisdickinson added the land-on-master label Apr 17, 2015
@Fishrock123

Fishrock123 commented May 21, 2015

Copy link
Copy Markdown
Contributor

@cjihrig is this (still?) lgty?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented May 30, 2015

Copy link
Copy Markdown
Contributor

@Fishrock123 the code changes themselves look good to me. I don't love the tests. Seems like a single test should be adequate, and it would be nice to simplify the test a bit if possible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Olegas

Olegas commented May 31, 2015

Copy link
Copy Markdown
Contributor Author

@cjihrig I think two tests are required to ensure both scheduling policies are working correct.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jun 1, 2015

Copy link
Copy Markdown
Contributor

I don't think the code being tested here is really reliant on the scheduling policy. Granted, the cluster module's behavior relies on the scheduling policy, but we don't need to duplicate every test to run under both policies. Maybe I'm missing something, but your changes to Worker.prototype.disconnect() only involve looping over a collection of handles. There are (or at least should be) other tests in place to ensure that collection of handles is generated correctly.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github

sam-github commented Jun 2, 2015

Copy link
Copy Markdown
Contributor

fwiw, I agree with @cjihrig about the tests.

As far as this change goes, it looks OK to me, though I haven't run or tested it. In particular, it looks like the ProgressTracker was lost in the cluster rewrite: https://github.com/joyent/node/blob/v0.10.38-release/lib/cluster.js#L520-L528, and this PR brings something like it back.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Olegas

Olegas commented Jun 2, 2015

Copy link
Copy Markdown
Contributor Author

@sam-github @cjihrig now there are only one test. If it is ok now I'll do rebase/squash to a single commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github

sam-github commented Jun 2, 2015

Copy link
Copy Markdown
Contributor

Please squash.

I just ran the test _without_ your changes, and the test passes when it should not. Can you check this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Olegas
cluster: wait for all servers closing before disconnect
35854ae
Fix for iojs/io,js#1305
Before this, cluster bahaves not the way it is docummented
Then disconnect is triggered, worker must wait for every server is closed
before doing disconnect actually.

See test case and discussion in the above mentioned issue
@Olegas
Olegas force-pushed the disconnect-waits-for-server-close branch from a923192 to 35854ae Compare June 2, 2015 20:56
@Olegas

Olegas commented Jun 2, 2015

Copy link
Copy Markdown
Contributor Author

@sam-github commits squashed, test fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sam-github
sam-github reviewed Jun 9, 2015
View reviewed changes
Comment thread test/parallel/test-cluster-worker-wait-server-close.js

@sam-github sam-github Jun 9, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

run make lint, this line is too long.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sam-github

sam-github commented Jun 9, 2015

Copy link
Copy Markdown
Contributor

I would just do the lint fixups and merge, but I'd like you to confirm that I'm not missing some subtlety about the exit event testing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Olegas

Olegas commented Jun 9, 2015

Copy link
Copy Markdown
Contributor Author

@sam-github Yes, exit event testing is not necessary. It is copy-paste from another cluster test (
I'll fix everything today evening and add docs too

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sam-github pushed a commit to sam-github/node that referenced this pull request Jun 9, 2015
@Olegas @sam-github
cluster: wait on servers closing before disconnect
9c0a1b8
Before this, cluster behaves not the way it is documented.  When
disconnect is triggered, worker must wait for every server is closed
before doing disconnect actually.

Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs#1400
Fixes: nodejs#1305
@sam-github

sam-github commented Jun 9, 2015

Copy link
Copy Markdown
Contributor

Cleaned up and landed in 9c0a1b8, thanks @Olegas

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github sam-github mentioned this pull request Jun 9, 2015
Worker disconnect is not waiting for server closing #1305
Closed
@cjihrig cjihrig closed this Jun 9, 2015
@Olegas

Olegas commented Jun 9, 2015

Copy link
Copy Markdown
Contributor Author

@sam-github I'm sorry, but tests now broken. First setTimeout is required.

If I run the test without my fixes, it will run forever. But if I set scheduling policy to SCHED_NONE test will fail (as expected)

This is because of default SCHED_RR scheduling policy on Linux/Mac/etc...

Then scheduling policy is SCHED_RR, connection is accepted inside of master and then passed to child process. If child process disconnects BEFORE response handler is completed, connection will not get accepted. So, child process never receives data and them keep running forever.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Jun 9, 2015

Copy link
Copy Markdown
Contributor

@sam-github I think this probably needed a CI run, you have access to the CI, right?

Anyways, here's a run on current master: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/788/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

thefourtheye
thefourtheye reviewed Jun 9, 2015
View reviewed changes
Comment thread lib/cluster.js

@thefourtheye thefourtheye Jun 9, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Why is this block necessary? Won't checkRemainingHandles itself handle this?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Olegas Olegas Jun 9, 2015

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What if we have no any handles yet?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Jun 9, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Cool. Thanks for clarifying :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Jun 10, 2015
async-wrap: add provider id and object info cb #1896
Closed
test: test-cluster-worker-wait-server-close.js is hanging #1933
Closed
cluster: fix broken/hanging tests #1934
Closed
@sam-github sam-github mentioned this pull request Jun 11, 2015
Revert "cluster: wait on servers closing before disconnect" #1945
Closed
@rvagg rvagg mentioned this pull request Jun 11, 2015
Release proposal: 2.3.0 #1939
Closed
sam-github added a commit that referenced this pull request Jun 12, 2015
@sam-github
test: fix cluster-worker-wait-server-close races
03ce84d
Wait for data to arrive from worker before doing a disconnect. Without
this, whether the disconnect arrives at the worker before the master
accepts and forwards the connection descriptor to the worker is a race.

Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
PR-URL: #1953
Fixes: #1933
Fixes: #1400
@sam-github sam-github mentioned this pull request Jun 15, 2015
cluster: wait for all servers closing before disconnect nodejs/node-v0.x-archive#25527
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cluster Issues and PRs related to the cluster subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@Olegas @Fishrock123 @cjihrig @sam-github @thefourtheye @brendanashworth @chrisdickinson @mscdex
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.