java.lang.InterruptedException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • GitHub comment 1635#251458269
    via GitHub by tcarette
    ,
  • 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}
    via by oleksiys,
  • GitHub comment 3589#278150612
    via GitHub by kcondon
    ,
    • java.lang.InterruptedException at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302) at scala.concurrent.impl.Promise$DefaultPromise.tryAwait(Promise.scala:202) at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:218) at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:153) at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:623) at org.apache.spark.SparkContext.runJob(SparkContext.scala:1871) at org.apache.spark.SparkContext.runJob(SparkContext.scala:1884) at org.apache.spark.SparkContext.runJob(SparkContext.scala:1897) at org.apache.spark.SparkContext.runJob(SparkContext.scala:1911) at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1.apply(RDD.scala:883) at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1.apply(RDD.scala:881) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112) at org.apache.spark.rdd.RDD.withScope(RDD.scala:358) at org.apache.spark.rdd.RDD.foreachPartition(RDD.scala:881) at ml.dmlc.xgboost4j.scala.spark.XGBoost$$anon$2.run(XGBoost.scala:205)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    tyson925tyson925
    36 times, last one,
    HandemelindoHandemelindo
    2 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    12 more bugmates