This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygrunsrv - services enters stopped state if underlying program exits or is killed - doesn't auto restart


Greetings, BGINFO4X!

>>> >> This is unfortunate because it diminishes the usefulness of --neverexits.
>>> >> I could patch cygrunsrv to do this:
>>> >>
>>> >>   If the service exited due to a signal, and if that signal is not the
>>> >>   defined termination or shutdown signal (default SIGTERM for both),
>>> >>   and if --neverexits has been defined, then performas the neverexits
>>> >>   action.
>>> >>
>>> >> Does that sound ok?
>>>
>>> I would say that this should be the default behavior:
>>>
>>> If the signal is SIGTERM and the service is configured to restart the
>>> program, then restart the program.
>>
>> No.  SIGTERM (rather: the defined termination signal) is send
>> explicitely from cygrunsrv to the service process to stop the service.
>> If this is handled like --neverexits, it would be impossible to stop a
>> service manually.  The neverexits case should only cover the cases of
>> exiting as a result of an unexpected signal (SIGSEGV, etc).

> I explained it bad. English is not my "default" language. :)

> What I mean is:

>    - If the automatic restart of the service is defined by the
> administrator, the service should restart by default.
>    - So, It shouldn't be necessary to register the service with --neverexits.

>     - But if the administrator defines the autorestart option, the
> service should be aware of it.

No. Autorestart is there to help recover from service failures, WHEN such
recovery is desired by the system administrator.
It has nothing to do with the nature of the service, neither require service
to be aware of it.


>>> So, --neverxits should be the default behaviour of cygrunsrv , so
>>> --neverexists shouldn't exist as an option. :) But perhaps I'm wrong
>>> and I don't understand completely the problem.
>>
>> I disagree.  Automatic restart of services is not desired by default.
>> It's a per-service, administrators choice.

I think I can explain it a little different.
If we view cygrunsrv as a wrapper(bridge) between Cygwin(POSIX) daemon and
Windows service infrastructure, all what is required from it (beside
environment initialization) is to convert Windows control messages to
appropriate POSIX signals.
And, conversely, appropriately react to POSIX signals when service is
terminating by itself.
I'm not very familiar with passing signals back to called process, but if
cygrunsrv can distinguish graceful termination of controlled daemon from
abnormal shutdown, the "--neverexits" switch become redundant in case of
correct signal mapping.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 28.01.2015, <20:36>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]