Archived

This forum has been archived. Please start a new discussion on GitHub.

How IceGrid shutdown a NodeJs?

I try to make NodeJs as IceServer and use IceGrid for managerment.
(We use NodeJs as WebServer as well,so that the developers use only HTML & JS for business development)

Now,I almost get it by using C++ Addons in NodeJs.(I have used slice2cpp, not slice2js)

The problem I meet when I use IceGrid to shutdown the Nodejs,it cost me just 60 seconds to wait.

Is there any API that i can get the shutdown order?
Is there anyother solution for my requirement?

Comments

  • benoit
    benoit Rennes, France
    Hi,

    On which platform do you have this issue?

    On Unix, the IceGrid node sends the SIGTERM signal to the process and on Windows it generates a Ctrl-Break event for the process. It sounds like your NodeJS process doesn't exit on getting this signal/event. The process API (https://nodejs.org/api/process.html ) allows to specify the behavior on getting this signal/event, you could try to set a handler to see if you correctly get these signals.

    If something is preventing the process to terminate in a promptly manner, the only workaround I can think of is to set a small deactivation timeout on the server by setting deactivation-timeout on the server descriptor.

    Cheers,
    Benoit.
  • Thanks.

    Finaly,i found that it's a threading problem in my C++ Addons.

    I have new a thread to run the ice communicator,so that the main thread can return to NodeJs to check the msg queue in C++ Addons. Now I set a flag to end it.