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

Replace nssm restart by powershell commands #282

Merged
merged 1 commit into from Mar 18, 2016

Conversation

Projects
None yet
3 participants
@kamaradclimber
Copy link
Contributor

commented Feb 24, 2016

Very frequenty nssm commands (stop and start) fail because the service
gets into STOP_PENDING or START_PENDING state.
powershell commandlets such as restart-service have the good taste to
wait for the service to stop/start completely.

Replace nssm restart by powershell commands
Very frequenty nssm commands (stop and start) fail because the service
gets into STOP_PENDING or START_PENDING state.
powershell commandlets such as restart-service have the good taste to
wait for the service to stop/start completely.
@johnbellone

This comment has been minimized.

Copy link
Contributor

commented Mar 18, 2016

I don't know too much about nssm to be honest. I did a little searching on the page and it seems like there are configurations where you can tweak some changes.

http://nssm.cc/usage

@johnbellone

This comment has been minimized.

Copy link
Contributor

commented Mar 18, 2016

/cc @Ginja since he wrote the Windows service provider.

@Ginja

This comment has been minimized.

Copy link
Collaborator

commented Mar 18, 2016

I haven't seen this too much in our environment. Have you tried playing with the restart delay option of NSSM, @kamaradclimber?

As of version 2.22, nssm can apply a mandatory delay between restarts of the application. This could be used, for example, to run a command at regular intervals such as an hourly batch script.

To specify a restart delay, create an integer (REG_DWORD) value HKLM\System\CurrentControlSet\Services\servicename\Parameters\AppDelay and set it to the number of milliseconds to wait between restarts.

The service will report its state as Paused while waiting for the next restart. Sending it a Continue control will temporarily cancel the delay and trigger a restart immediately.

Please see the section on restart throttling below for notes on how nssm works when both throttling and restart delays are configured.

@kamaradclimber

This comment has been minimized.

Copy link
Contributor Author

commented Mar 18, 2016

thanks @Ginja for you reply. As far as I understand the restart delay option it only deals with a delay between the service stop and the moment nssm tries to start it again.

In my case, a simple restart command send to nssm is causing the state.

It seems to be due to consul taking some time to stop (writing some information to disk) that might be long (a few seconds for a 2k node cluster) and nssm does not wait properly for process termination thus declaring the service as "stop pending".

Apparently powershell commandlets handle this correctly.

@Ginja

This comment has been minimized.

Copy link
Collaborator

commented Mar 18, 2016

@kamaradclimber thanks for the clarification, that makes sense. I don't manage that large of a fleet in one Consul data centre, which probably would explain why I never ran into this issue. I just tested using those cmdlets locally & it looks like it'll work fine with NSSM.

I'd say go ahead & merge this, @johnbellone.

johnbellone added a commit that referenced this pull request Mar 18, 2016

Merge pull request #282 from criteo-forks/criteo
Replace nssm restart by powershell commands

@johnbellone johnbellone merged commit 3c3e75d into sous-chefs:master Mar 18, 2016

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
@kamaradclimber

This comment has been minimized.

Copy link
Contributor Author

commented Mar 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.