[JIRA] Commented: (GRIZZLY-1673) Grizzly Graceful Shutdown throws InterruptedException

  • From: "oleksiys (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Commented: (GRIZZLY-1673) Grizzly Graceful Shutdown throws InterruptedException
  • Date: Thu, 15 May 2014 01:59:49 +0000 (UTC)
  • Auto-submitted: auto-generated


    [ 
https://java.net/jira/browse/GRIZZLY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=375409#action_375409
 ] 

oleksiys commented on GRIZZLY-1673:
-----------------------------------

fixed on master

Revision:   ac2181b475cccba75dd95a5226e36d6ceef16e1b
Date:       2014-04-30 16:29:52 UTC

Log Message:
------------
[master] [master] + fix issue #1673
https://java.net/jira/browse/GRIZZLY-1673

"Grizzly Graceful Shutdown throws InterruptedException"

> Grizzly Graceful Shutdown throws InterruptedException
> -----------------------------------------------------
>
>                 Key: GRIZZLY-1673
>                 URL: https://java.net/jira/browse/GRIZZLY-1673
>             Project: grizzly
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: 2.3.11
>            Reporter: oleksiys
>             Fix For: 2.3.12
>
>
> I'm working with a jersey server and want to be sure that when the server 
> is terminated (usually via SIGTERM), all currently running requests are 
> completed gracefully. If volume is high enough, there will likely be data 
> loss if I don't do this.
> So I'm trying to call HttpServer.shutdown() from a runtime shutdown hook.
> I think it is working correctly, except for one problem. 
> CompletionHandler.failed() is invoked, with an InterruptedException. 
> shutdownNow is in the stack trace, so it seems like there is just some 
> logical error occurring after the shutdown itself has finished:
> {code}
> java.lang.InterruptedException
>     at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl$Sync.innerGet(SafeFutureImpl.java:354)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.get(SafeFutureImpl.java:265)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.notifyCompletionHandlers(SafeFutureImpl.java:181)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.done(SafeFutureImpl.java:287)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl$Sync.innerSet(SafeFutureImpl.java:383)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.result(SafeFutureImpl.java:112)
>     at 
> org.glassfish.grizzly.http.server.HttpServer.shutdownNow(HttpServer.java:458)
>     at 
> org.glassfish.grizzly.http.server.HttpServer$1.completed(HttpServer.java:384)
>     at 
> org.glassfish.grizzly.http.server.HttpServer$1.completed(HttpServer.java:376)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.notifyCompletionHandlers(SafeFutureImpl.java:199)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.done(SafeFutureImpl.java:287)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl$Sync.innerSet(SafeFutureImpl.java:383)
>     at 
> org.glassfish.grizzly.impl.SafeFutureImpl.result(SafeFutureImpl.java:112)
>     at 
> org.glassfish.grizzly.http.server.NetworkListener$1$1.completed(NetworkListener.java:698)
>     at 
> org.glassfish.grizzly.http.server.NetworkListener$1$1.completed(NetworkListener.java:693)
>     at 
> org.glassfish.grizzly.http.server.HttpServerFilter.prepareForShutdown(HttpServerFilter.java:328)
>     at 
> org.glassfish.grizzly.http.server.NetworkListener$1.shutdownRequested(NetworkListener.java:704)
>     at 
> org.glassfish.grizzly.nio.GracefulShutdownRunner.run(GracefulShutdownRunner.java:93)
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>     at java.lang.Thread.run(Thread.java:744)
> {code}
> I boiled it down to this test case which does not use jersey or a shutdown 
> hook. It's very simple and the same exception occurs (in fact, the above is 
> copied from the output of this program):
> {code}
> public class Server {
>     public static void main(String[] args) throws IOException {
>         HttpServer server = HttpServer.createSimpleServer();
>         server.start();
>         try { Thread.sleep(5000); } catch (InterruptedException ex) {}
>         shutdown(server);
>     }
>     public static void shutdown (HttpServer server) {
>         final boolean [] done = {false};
>         server.shutdown().addCompletionHandler(new 
> EmptyCompletionHandler<HttpServer>() {
>             public void completed (HttpServer arg) {
>                 System.out.println("Shutdown completed");
>                 done[0] = true;
>             }
>             public void failed (Throwable error) {
>                 System.out.println("Shutdown failed");
>                 error.printStackTrace(System.out);
>                 done[0] = true;
>             }
>         });
>         while (!done[0]) {
>             try { Thread.sleep(100); } catch (InterruptedException ex) {}
>         }
>         System.out.println("Goodbye");
>     }
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Commented: (GRIZZLY-1673) Grizzly Graceful Shutdown throws InterruptedException

oleksiys (JIRA) 05/15/2014
Terms of Use; Privacy Policy; Copyright ©2013-2015 (revision 20150626.29986a4)
 
 
Close
loading
Please Confirm
Close