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

ASF GitHub Bot commented on FLINK-9900:
---------------------------------------

zentol closed pull request #6468: [FLINK-9900][tests] Include more information 
on timeout in Zookeeper HA ITCase
URL: https://github.com/apache/flink/pull/6468
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/ZooKeeperHighAvailabilityITCase.java
 
b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/ZooKeeperHighAvailabilityITCase.java
index b83f89e4ca5..642af40aaf2 100644
--- 
a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/ZooKeeperHighAvailabilityITCase.java
+++ 
b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/ZooKeeperHighAvailabilityITCase.java
@@ -50,6 +50,7 @@
 import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.test.util.MiniClusterResource;
 import org.apache.flink.test.util.MiniClusterResourceConfiguration;
+import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.Preconditions;
 import org.apache.flink.util.TestLogger;
 
@@ -62,6 +63,11 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -163,7 +169,7 @@ public static void tearDown() throws Exception {
         *       restored successfully
         * </ol>
         */
-       @Test(timeout = 120_000L)
+       @Test
        public void testRestoreBehaviourWithFaultyStateHandles() throws 
Exception {
                
CheckpointBlockingFunction.allowedInitializeCallsWithoutRestore.set(1);
                CheckpointBlockingFunction.successfulRestores.set(0);
@@ -256,13 +262,54 @@ public FileVisitResult visitFile(Path file, 
BasicFileAttributes attrs) throws IO
                        () -> clusterClient.getJobStatus(jobID),
                        Time.milliseconds(50),
                        deadline,
-                       (jobStatus) -> jobStatus == JobStatus.FINISHED,
+                       JobStatus::isGloballyTerminalState,
                        TestingUtils.defaultScheduledExecutor());
-               assertEquals(JobStatus.FINISHED, jobStatusFuture.get());
+               try {
+                       assertEquals(JobStatus.FINISHED, jobStatusFuture.get());
+               } catch (Throwable e) {
+                       // include additional debugging information
+                       StringWriter error = new StringWriter();
+                       try (PrintWriter out = new PrintWriter(error)) {
+                               out.println("The job did not finish in time.");
+                               
out.println("allowedInitializeCallsWithoutRestore= " + 
CheckpointBlockingFunction.allowedInitializeCallsWithoutRestore.get());
+                               out.println("illegalRestores= " + 
CheckpointBlockingFunction.illegalRestores.get());
+                               out.println("successfulRestores= " + 
CheckpointBlockingFunction.successfulRestores.get());
+                               out.println("afterMessWithZooKeeper= " + 
CheckpointBlockingFunction.afterMessWithZooKeeper.get());
+                               out.println("failedAlready= " + 
CheckpointBlockingFunction.failedAlready.get());
+                               out.println("currentJobStatus= " + 
clusterClient.getJobStatus(jobID).get());
+                               out.println("numRestarts= " + 
RestartReporter.numRestarts.getValue());
+                               out.println("threadDump= " + 
generateThreadDump());
+                       }
+                       throw new AssertionError(error.toString(), 
ExceptionUtils.stripCompletionException(e));
+               }
 
                assertThat("We saw illegal restores.", 
CheckpointBlockingFunction.illegalRestores.get(), is(0));
        }
 
+       private static String generateThreadDump() {
+               final StringBuilder dump = new StringBuilder();
+               final ThreadMXBean threadMXBean = 
ManagementFactory.getThreadMXBean();
+               final ThreadInfo[] threadInfos = 
threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds(), 100);
+               for (ThreadInfo threadInfo : threadInfos) {
+                       dump.append('"');
+                       dump.append(threadInfo.getThreadName());
+                       dump.append('"');
+                       final Thread.State state = threadInfo.getThreadState();
+                       dump.append(System.lineSeparator());
+                       dump.append("   java.lang.Thread.State: ");
+                       dump.append(state);
+                       final StackTraceElement[] stackTraceElements = 
threadInfo.getStackTrace();
+                       for (final StackTraceElement stackTraceElement : 
stackTraceElements) {
+                               dump.append(System.lineSeparator());
+                               dump.append("        at ");
+                               dump.append(stackTraceElement);
+                       }
+                       dump.append(System.lineSeparator());
+                       dump.append(System.lineSeparator());
+               }
+               return dump.toString();
+       }
+
        private static class UnboundedSource implements SourceFunction<String> {
                private volatile boolean running = true;
 


 

----------------------------------------------------------------
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]


> Failed to testRestoreBehaviourWithFaultyStateHandles 
> (org.apache.flink.test.checkpointing.ZooKeeperHighAvailabilityITCase) 
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-9900
>                 URL: https://issues.apache.org/jira/browse/FLINK-9900
>             Project: Flink
>          Issue Type: Bug
>          Components: Tests
>    Affects Versions: 1.5.1, 1.6.0
>            Reporter: zhangminglei
>            Assignee: Chesnay Schepler
>            Priority: Critical
>              Labels: pull-request-available
>             Fix For: 1.6.1, 1.7.0, 1.5.4
>
>
> https://api.travis-ci.org/v3/job/405843617/log.txt
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 124.598 sec 
> <<< FAILURE! - in 
> org.apache.flink.test.checkpointing.ZooKeeperHighAvailabilityITCase
>  
> testRestoreBehaviourWithFaultyStateHandles(org.apache.flink.test.checkpointing.ZooKeeperHighAvailabilityITCase)
>  Time elapsed: 120.036 sec <<< ERROR!
>  org.junit.runners.model.TestTimedOutException: test timed out after 120000 
> milliseconds
>  at sun.misc.Unsafe.park(Native Method)
>  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
>  at 
> java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1693)
>  at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
>  at 
> java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1729)
>  at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
>  at 
> org.apache.flink.test.checkpointing.ZooKeeperHighAvailabilityITCase.testRestoreBehaviourWithFaultyStateHandles(ZooKeeperHighAvailabilityITCase.java:244)
> Results :
> Tests in error: 
>  
> ZooKeeperHighAvailabilityITCase.testRestoreBehaviourWithFaultyStateHandles:244
>  » TestTimedOut
> Tests run: 1453, Failures: 0, Errors: 1, Skipped: 29



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

Reply via email to