Skip to content
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

Termination signals are not generated on CF stop or CF restage #249

Closed
sumanth10 opened this issue May 4, 2018 · 2 comments
Closed

Termination signals are not generated on CF stop or CF restage #249

sumanth10 opened this issue May 4, 2018 · 2 comments
Labels

Comments

@sumanth10
Copy link

I have a CF node app running and I have some functions that need to be called as a part of cleanup on app exit. I have called those cleanup functions on process.exit event. But unfortunately, I am not seeing the clean up happening. Is there any extra parameter that I need to set for this cleanup function to be executed.This is the event listener and cleanup functions I have written


function exitHandler(options, err) {
    console.log("INSIDE EXITHANDLER")
    if (options.cleanup) console.log("I am Dead")
    if (err) console.log(err.stack);
    if (options.exit) process.exit();
    
}

//do something when app is closing
process.on('exit', exitHandler.bind(null,{cleanup:true}));

//catches ctrl+c event
process.on('SIGINT', exitHandler.bind(null, {exit:true}));
process.on('SIGTERM', exitHandler.bind(null, {exit:true}));

// catches "kill pid" (for example: nodemon restart)
process.on('SIGUSR1', exitHandler.bind(null, {exit:true}));
process.on('SIGUSR2', exitHandler.bind(null, {exit:true}));

//catches uncaught exceptions
process.on('uncaughtException', exitHandler.bind(null, {exit:true}));
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

@seviet
Copy link
Contributor

seviet commented May 4, 2018

hi @sumanth10! sorry to hear you're having trouble. I think you might have better luck getting help with your particular question on the Cloud Foundry Slack https://cloudfoundry.slack.com. #cf-users or the #general channel might be good starting points. If you find out that the issue is something we need to fix or add to the docs, please feel free to come back and file another issue or PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants