Artur,

I've only looked at this fairly briefly so far, but at first guess it looks like the Runtime.exec() call is not terminating properly.

There are actually two methods of termination, one using Ctrl-C (which executes a ShutdownHook instance) or using the control port to send a shutdown call to winstone. The log you posted is consistent with the first method, but the second method gives different results:

Method 1: (Ctrl-C)

[rickk@node1 WebApplication1]$ ./start.sh
[Winstone 2006/05/03 21:16:12] - Beginning extraction from war file
[Winstone 2006/05/03 21:16:15] - No webapp lib folder found - /tmp/winstone/WebApplication1.war/WEB-INF/lib
notifier: start-up<0>
sending `constructor'
sending `contextInitialized'
notifier: start-up<1>
[Winstone 2006/05/03 21:16:16] - AJP13 Listener started: port=8009
[Winstone 2006/05/03 21:16:16] - HTTP Listener started: port=8080
[Winstone 2006/05/03 21:16:16] - Winstone Servlet Engine v0.8.1 running: controlPort=disabled
notifier: shutdown<0>
sending `shutdown'
notify: error: java.io.IOException: Broken pipe
notifier: shutdown<1>
[Winstone 2006/05/03 21:16:19] - Control thread shutdown successfully
[Winstone 2006/05/03 21:16:19] - Winstone shutdown successfully
(exits cleanly)

Method 2: (using the winstone control port)

[rickk@node1 WebApplication1]$ ./start.sh
[Winstone 2006/05/03 21:57:34] - Beginning extraction from war file
[Winstone 2006/05/03 21:57:36] - No webapp lib folder found - /tmp/winstone/WebApplication1.war/WEB-INF/lib
notifier: start-up<0>
sending `constructor'
sending `contextInitialized'
notifier: start-up<1>
[Winstone 2006/05/03 21:57:37] - HTTP Listener started: port=8080
[Winstone 2006/05/03 21:57:37] - Winstone Servlet Engine v0.8.1 running: controlPort=9090
[Winstone 2006/05/03 21:57:37] - AJP13 Listener started: port=8009
[Winstone 2006/05/03 21:57:40] - Shutdown request received via the controlPort. Commencing Winstone shutdown
notifier: shutdown<0>
sending `shutdown'
notifier: shutdown<1>
[Winstone 2006/05/03 21:57:40] - Winstone shutdown successfully
[Winstone 2006/05/03 21:57:42] - HTTP Listener shutdown successfully
[Winstone 2006/05/03 21:57:42] - AJP13 Listener shutdown successfully
(hangs)

This one shuts down without any stream exceptions but doesn't exit. Winstone deliberately doesn't have a System.exit() call, because I wanted to be able to see exactly this kind of child thread error when it happens.

Interestingly enough, when I ran Method 2 with the CVS version of winstone (0.8.2-cvs) it shuts down cleanly. Not exactly sure why this works, but I did add an additional termination check in the control thread, so maybe that fixed this bug by accident.

My advice would be to use the CVS version (I'll mail you one) and don't use Ctrl-C to exit. The javadocs actually say that using ShutdownHooks are not all that reliable anyway, so if clean shutdowns are important to you use the control port method. Alternatively, embed winstone in your own launcher: see http://winstone.sourceforge.net/#embedding. Then you can handle it however you like.

Hope that helps,

Rick

randomJavaTroll wrote:
Hello,

I am sending you the source and the war file. To recompile use ant dist, the app is also a Netbeans project. The bin folder contains the executable that reads from the pipe, it can be recompiled using bin/compile.sh. The server is started using start.sh. There are the debugging messages written to stdout, when I ran the app they were as follows:

[Winstone 2006/05/03 12:19:36] - Beginning extraction from war file
[Winstone 2006/05/03 12:19:36] - No webapp lib folder found - /tmp/winstone/WebApplication1.war/WEB-INF/lib
notifier: start-up<0>
sending `constructor'
sending `contextInitialized'
notifier: start-up<1>
[Winstone 2006/05/03 12:19:37] - HTTP Listener started: port=8080
[Winstone 2006/05/03 12:19:37] - Winstone Servlet Engine v0.8.1 running: controlPort=disabled
[Winstone 2006/05/03 12:19:37] - AJP13 Listener started: port=8009
notifier: shutdown<0>
sending `shutdown'
notify: error: java.io.IOException: Broken pipe
notifier: shutdown<1>
[Winstone 2006/05/03 12:19:39] - Control thread shutdown successfully
[Winstone 2006/05/03 12:19:39] - Winstone shutdown successfully

Thanks,
Artur


-- 
Servlet v2.4 container in a single 160KB jar file ? Try Winstone (http://winstone.sourceforge.net/)