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: worker.disconnect waits for handles to close before firing "disconnect" event · Issue #4542 · nodejs/node

Cluster: worker.disconnect waits for handles to close before firing "disconnect" event #4542

New issue
Copy link
New issue
Copy link
Closed
Closed
Cluster: worker.disconnect waits for handles to close before firing "disconnect" event#4542
Copy link
Labels
clusterIssues and PRs related to the cluster subsystem.

Description

@cjthompson
cjthompson
opened on Jan 5, 2016
Issue body actions

In the classic (0.10) cluster scheduler (SCHED_NONE), when worker.disconnect() is called, the worker immediately emits a "disconnect" event, then proceeds to wait for exiting connections to close before terminating the child process:

node/lib/cluster.js

Line 404 in f299d87

Worker.prototype.disconnect = function() {

In the Round Robin mode, worker.disconnect() does not fire a disconnect event, and it waits for all the handles to close before disconnecting the child process.

node/lib/cluster.js

Line 655 in f299d87

Worker.prototype.disconnect = function() {

In short, the old behavior was to: 1) fire "disconnect", 2) wait for handles to close, 3) fire "exit". The new behavior is 1) disconnect IPC (but don't fire "disconnect" event), 2) wait for handles to close, 3) fire "disconnect" event, 4) fire "exit" event

The scenario I'm looking at is if a worker disconnects, I'd like the master to immediately start a new worker in its place, while waiting for the previous worker to terminate (or force terminate it if it takes too long to close on its own).

This was possible with the old scheduler, but not the round robin scheduler.

Activity

  1. cjthompson commented on Jan 5, 2016

    @cjthompson
    cjthompson
    on Jan 5, 2016
    Author
    More actions

    I've also been able to trigger this error after a worker disconnects:

    events.js:141
          throw er; // Unhandled 'error' event
          ^
    
    Error: IPC channel is already disconnected
        at process.target.disconnect (internal/child_process.js:631:26)
        at Server.checkRemainingHandles (cluster.js:659:17)
        at Server.g (events.js:260:16)
        at emitNone (events.js:67:13)
        at Server.emit (events.js:166:7)
        at emitCloseNT (net.js:1521:8)
        at doNTCallback1 (node.js:430:9)
        at process._tickCallback (node.js:352:17)
    
  2. r-52
    added
    clusterIssues and PRs related to the cluster subsystem.
    on Jan 5, 2016
  3. cjihrig commented on Jan 15, 2016

    @cjihrig
    cjihrig
    on Jan 15, 2016
    Contributor
    More actions

    What version of Node are you using? What operating system? You're a lot more likely to get help if you provide code (with no external dependencies) to reproduce the problem.

  4. Trott commented on Jan 16, 2016

    @Trott
    Trott
    on Jan 16, 2016
    Member
    More actions

    Note also that there have been two possibly-relevant changes to disconnect behavior since the version of cluster.js linked to in this issue.

    • f9f1dd9
    • 9571be1
  5. cjthompson commented on Jan 18, 2016

    @cjthompson
    cjthompson
    on Jan 18, 2016
    Author
    More actions

    I've been unable to reproduce the issue using a simple example, so I'm closing this issue.

  6. cjthompson
    closed this as completedon Jan 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clusterIssues and PRs related to the cluster subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.