This is the mail archive of the cygwin@cygwin.com 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 and spawned processes


Igor,

Just to be clear, I have now spent the better part of the day working on
this, trying to fathom what's going on.  All I can say is, cygrunsrv is
doing _something_ differently when it comes to running Cygwin apps
compared to running them from the BASH shell.

I have now tested this every way from Sunday, and sure enough, if I run
Jabberd from BASH ('-D' is for debug mode):

	$ cd /usr/local/jabber
	$ ./jabberd/jabberd.exe -D

jabberd.exe fires up and spawns jabadns.exe.  When I hit CTRL-C, both
die gracefully.  When I use cygrunsrv, for example with the following:

cygrunsrv --install jabberd --path /usr/local/jabber/jabberd/jabberd
--args "-D" --chdir /usr/local/jabber --env
PATH=/usr/local/bin:/usr/bin:/bin --disp "JABBER Server" --user jabber
--termsig INT --shutdown

and then type

net start jabberd

jabberd.exe fires up and spawns jabadns.exe. However, when I type

net stop jabberd

only jabberd.exe dies.  jabadns.exe remains behind.  Again, if I repeat
this process, I end up with zombie jabadns.exe processes, each consuming
a few MB RAM.

It's not so much the RAM usage as the inconsistency.  I would love to
have this working cleanly.

I've also run Jabberd in debug mode (it's quite verbose), and using the
example above, the debug logs are _identical_.  They show the same
signal (2) being received, and the exact same sequence of debug
messages.  So it's not like jabberd.exe is being killed off viciously
with a 'kill -9' type termination.  But for some reason, jabadns.exe is
not being terminated.

The only thing I can think to do now is add a bunch of environment vars
to the cygrunsrv line, but not sure what could possibly be needed by
cygrunsrv to kill a process.  Only thought I have left.


Igor Pechtchanski wrote:


...
Frank,

When you press Ctrl-C in bash, the application gets SIGINT.  When you stop
the service installed by cygrunsrv, by default the signal is SIGTERM,
which the application may not handle gracefully.  Try the '--termsig INT'
('-s 2') cygrunsrv option.
	Igor




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


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