Skip to content

How to properly handle SIGUSR2 Signal sent by nodemon #213

@Kannaj

Description

@Kannaj

Hello ,

When nodemon sends a sigusr2 signal to node , i'm handling it like the below

    process.on('SIGUSR2',function(){
        console.log('SIGUSR2 recieved')
        socketcluster.killWorkers();
        socketcluster.killBrokers();
        process.exit(1)
      })
root        50  0.0  0.0      0     0 ?        Z    07:58   0:00 [node] <defunct>
root        60  0.8  0.0      0     0 ?        Z    07:58   0:01 [node] <defunct>
root        65  0.7  0.0      0     0 ?        Z    07:58   0:01 [node] <defunct>
root        70  0.5  0.0      0     0 ?        Z    07:58   0:00 [node] <defunct>
root        75  3.0  0.0      0     0 ?        Z    07:58   0:05 [node] <defunct>
root        91  0.0  0.0      0     0 ?        Z    08:00   0:00 [node] <defunct>
root        96  1.9  0.0      0     0 ?        Z    08:00   0:01 [node] <defunct>
root       101  1.7  0.0      0     0 ?        Z    08:00   0:01 [node] <defunct>
root       106  1.2  0.0      0     0 ?        Z    08:00   0:00 [node] <defunct>
root       111  7.2  0.0      0     0 ?        Z    08:00   0:04 [node] <defunct>

The problem is that i dont think the worker/broker processes are properly terminated before the master process exits. This is creating zombie processes. Is there a better way to handle the SIGUSR2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions