Graceful shutdown of Windows service, revisited
-----------------------------------------------

                 Key: KARAF-327
                 URL: https://issues.apache.org/jira/browse/KARAF-327
             Project: Karaf
          Issue Type: Bug
          Components: wrapper
    Affects Versions: 2.1.2
         Environment: Windows XP SP 3
            Reporter: Bengt Rodehav


I'm trying to make my Karaf service more resilient to shutdown. In particular I 
want my Camel routes to shutdown gracefully. I started this discussion a few 
months ago, see http://www.mail-archive.com/[email protected]/msg00084.html.

Guillaume created the JIRA ticket KARAF-176 which is also resolved. I haven't 
had time to test this until now.

It seems to me that the problem persists. I'm now using Karaf 2.1.2 and Camel 
2.5.0. When I run Karaf from the command line and terminates Karaf by pressing 
<ctrl-D>, Camel will gracefully shutdown. It looks something like this:

2010-12-09 13:04:51,737 | INFO  | FelixStartLevel  | DefaultShutdownStrategy    
      | mel.impl.DefaultShutdownStrategy  114 | Starting to graceful shutdown 1 
routes (timeout 300 seconds)
2010-12-09 13:04:51,737 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  383 | Route: route1 suspended and 
shutdown deferred, was consuming from: 
Endpoint[file://C:\dev\Karaf\connect\common/data/interfaces/sample/file2file?delay=10000&include=%28%3Fi%29.*%28%3F%3C%21%5C.TMP%29&move=archive%2F%24%7Bdate%3Anow%3AyyyyMMdd%7D%2F%24%7Bfile%3Aonlyname%7D&moveFailed=failed%2F%24%7Bfile%3Aonlyname.noext%7D-%24%7Bdate%3Anow%3AyyyyMMddHHmmssSSS%7D.%24%7Bfile%3Aext%7D]
2010-12-09 13:04:51,737 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  422 | Waiting as there are still 1 
inflight and pending exchanges to complete, timeout in 300 seconds.
2010-12-09 13:04:52,737 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  422 | Waiting as there are still 1 
inflight and pending exchanges to complete, timeout in 299 seconds.
2010-12-09 13:04:53,737 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  422 | Waiting as there are still 1 
inflight and pending exchanges to complete, timeout in 298 seconds.
...
2010-12-09 13:06:54,782 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  422 | Waiting as there are still 1 
inflight and pending exchanges to complete, timeout in 177 seconds.
2010-12-09 13:06:55,782 | INFO  | 1 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  442 | Route: route1 shutdown complete.
2010-12-09 13:06:55,782 | INFO  | FelixStartLevel  | DefaultShutdownStrategy    
      | mel.impl.DefaultShutdownStrategy  146 | Graceful shutdown of 1 routes 
completed in 124 seconds
2010-12-09 13:06:55,798 | INFO  | FelixStartLevel  | DefaultInflightRepository  
      | l.impl.DefaultInflightRepository   93 | Shutting down with no inflight 
exchanges.
2010-12-09 13:06:55,798 | INFO  | FelixStartLevel  | DefaultCamelContext        
      | e.camel.impl.DefaultCamelContext 1374 | Uptime: 2 minutes
2010-12-09 13:06:55,798 | INFO  | FelixStartLevel  | DefaultCamelContext        
      | e.camel.impl.DefaultCamelContext 1375 | Apache Camel 2.5.0 
(CamelContext: Sample file transfer from file to file) is shutdown in 2 minutes
...

But when Karaf is running as a service (I run on Windows XP SP 3) and stop the 
service from the control panel. Karaf, and therefore Camel, is abruptly killed. 
It looks like this:

2010-12-09 12:36:11,103 | INFO  | FelixStartLevel  | DefaultShutdownStrategy    
      | mel.impl.DefaultShutdownStrategy  114 | Starting to graceful shutdown 1 
routes (timeout 300 seconds)
2010-12-09 12:36:11,103 | INFO  | 4 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  383 | Route: route2 suspended and 
shutdown deferred, was consuming from: 
Endpoint[file://C:\dev\Karaf\connect\common/data/interfaces/sample/file2file?delay=10000&include=%28%3Fi%29.*%28%3F%3C%21%5C.TMP%29&move=archive%2F%24%7Bdate%3Anow%3AyyyyMMdd%7D%2F%24%7Bfile%3Aonlyname%7D&moveFailed=failed%2F%24%7Bfile%3Aonlyname.noext%7D-%24%7Bdate%3Anow%3AyyyyMMddHHmmssSSS%7D.%24%7Bfile%3Aext%7D]
2010-12-09 12:36:11,103 | INFO  | 4 - ShutdownTask | DefaultShutdownStrategy    
      | ultShutdownStrategy$ShutdownTask  422 | Waiting as there are still 1 
inflight and pending exchanges to complete, timeout in 300 seconds.

Nothing more is logged since the process is killed. I know that there is never 
a guarantee that Karaf will shutdown gracefully since the process might just 
die (e g out of power). But it would be nice if the control panel could be used 
for stopping the service since thats what most operations engineers do. There 
is always the option to log in to Karaf via SSH and issue the shutdown command 
before stopping the service but then it becomes too complicated for most people.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to