[ 
https://issues.apache.org/jira/browse/DRILL-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16488154#comment-16488154
 ] 

ASF GitHub Bot commented on DRILL-6415:
---------------------------------------

ilooner commented on a change in pull request #1281: DRILL-6415: Fixed 
TestGracefulShutdown.TestRestApi test from timing out
URL: https://github.com/apache/drill/pull/1281#discussion_r190422417
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java
 ##########
 @@ -201,24 +201,21 @@ public void testRestApi() throws Exception {
     builder = enableWebServer(builder);
     QueryBuilder.QuerySummaryFuture listener;
     final String sql = "select * from dfs.root.`.`";
-    try ( ClusterFixture cluster = builder.build();
+    try (ClusterFixture cluster = builder.build();
           final ClientFixture client = cluster.clientFixture()) {
       Drillbit drillbit = cluster.drillbit("db1");
-      int port = 
drillbit.getContext().getConfig().getInt("drill.exec.http.port");
-      int grace_period = 
drillbit.getContext().getConfig().getInt(ExecConstants.GRACE_PERIOD);
+      int port = drillbit.getWebServerPort();
+      int gracePeriod = 
drillbit.getContext().getConfig().getInt(ExecConstants.GRACE_PERIOD);
       listener =  client.queryBuilder().sql(sql).futureSummary();
       Thread.sleep(60000);
-      while( port < 8049) {
-        URL url = new URL("http://localhost:"+port+"/gracefulShutdown";);
-        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        conn.setRequestMethod("POST");
-        if (conn.getResponseCode() != 200) {
-          throw new RuntimeException("Failed : HTTP error code : "
-                  + conn.getResponseCode());
-        }
-        port++;
+      URL url = new URL("http://localhost:"; + port + "/gracefulShutdown");
+      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+      conn.setRequestMethod("POST");
+      if (conn.getResponseCode() != 200) {
+        throw new RuntimeException("Failed : HTTP error code : "
+                + conn.getResponseCode());
       }
-      Thread.sleep(grace_period);
+      Thread.sleep(gracePeriod);
 
 Review comment:
   In fact since we are doing the same thing in the other test could you move 
this code into a helper method?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Unit test TestGracefulShutdown.testRestApiShutdown times out
> ------------------------------------------------------------
>
>                 Key: DRILL-6415
>                 URL: https://issues.apache.org/jira/browse/DRILL-6415
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Tools, Build &amp; Test
>            Reporter: Abhishek Girish
>            Assignee: Venkata Jyothsna Donapati
>            Priority: Major
>             Fix For: 1.14.0
>
>
> {code}
> 16:03:40.415 [main] ERROR org.apache.drill.TestReporter - Test Failed (d: 
> -18.3 KiB(72.9 KiB), h: -335.3 MiB(1.3 GiB), nh: 1.1 MiB(335.9 MiB)): 
> testRestApiShutdown(org.apache.drill.test.TestGracefulShutdown)
> org.junit.runners.model.TestTimedOutException: test timed out after 180000 
> milliseconds
>       at sun.misc.Unsafe.park(Native Method) ~[na:1.8.0_161]
>       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) 
> ~[na:1.8.0_161]
>       at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitUninterruptibly(AbstractQueuedSynchronizer.java:1976)
>  ~[na:1.8.0_161]
>       at 
> org.apache.drill.exec.work.WorkManager.waitToExit(WorkManager.java:203) 
> ~[classes/:na]
>       at org.apache.drill.exec.server.Drillbit.close(Drillbit.java:242) 
> ~[classes/:na]
>       at 
> org.apache.drill.test.ClusterFixture.safeClose(ClusterFixture.java:454) 
> ~[test-classes/:1.14.0-SNAPSHOT]
>       at org.apache.drill.test.ClusterFixture.close(ClusterFixture.java:405) 
> ~[test-classes/:1.14.0-SNAPSHOT]
>       at 
> org.apache.drill.test.TestGracefulShutdown.testRestApiShutdown(TestGracefulShutdown.java:294)
>  ~[test-classes/:1.14.0-SNAPSHOT]
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[na:1.8.0_161]
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[na:1.8.0_161]
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[na:1.8.0_161]
>       at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>  ~[junit-4.12.jar:4.12]
>       at 
> mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:154)
>  ~[jmockit-1.39.jar:1.39]
>       at 
> mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:70)
>  ~[jmockit-1.39.jar:1.39]
>       at 
> mockit.integration.junit4.internal.FakeFrameworkMethod.invokeExplosively(FakeFrameworkMethod.java:34)
>  ~[jmockit-1.39.jar:1.39]
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
> ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) 
> ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
>  ~[junit-4.12.jar:4.12]
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> ~[na:1.8.0_161]
>       at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_161]
> {code}
> {code}
> testRestApiShutdown(org.apache.drill.test.TestGracefulShutdown)  Time 
> elapsed: 180.028 sec  <<< ERROR!
> org.junit.runners.model.TestTimedOutException: test timed out after 180000 
> milliseconds
>       at sun.misc.Unsafe.park(Native Method)
>       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
>       at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitUninterruptibly(AbstractQueuedSynchronizer.java:1976)
>       at 
> org.apache.drill.exec.work.WorkManager.waitToExit(WorkManager.java:203)
>       at org.apache.drill.exec.server.Drillbit.close(Drillbit.java:242)
>       at 
> org.apache.drill.test.ClusterFixture.safeClose(ClusterFixture.java:454)
>       at org.apache.drill.test.ClusterFixture.close(ClusterFixture.java:405)
>       at 
> org.apache.drill.test.TestGracefulShutdown.testRestApiShutdown(TestGracefulShutdown.java:294)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to