flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] zentol commented on a change in pull request #6468: [FLINK-9900][tests] Include more information on timeout in Zookeeper HA ITCase
Date Tue, 14 Aug 2018 09:09:04 GMT
zentol commented on a change in pull request #6468: [FLINK-9900][tests] Include more information
on timeout in Zookeeper HA ITCase
URL: https://github.com/apache/flink/pull/6468#discussion_r209879523
 
 

 ##########
 File path: flink-tests/src/test/java/org/apache/flink/test/checkpointing/ZooKeeperHighAvailabilityITCase.java
 ##########
 @@ -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) {
 
 Review comment:
   The output is nicer if we go with the original option:
   without Throwable (i.e. current PR revision):
   ```
   "Monitor Ctrl-Break"
      java.lang.Thread.State: RUNNABLE
           at java.net.SocketInputStream.socketRead0(Native Method)
           at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
           at java.net.SocketInputStream.read(SocketInputStream.java:170)
           at java.net.SocketInputStream.read(SocketInputStream.java:141)
           at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
           at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
           at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
           at java.io.InputStreamReader.read(InputStreamReader.java:184)
           at java.io.BufferedReader.fill(BufferedReader.java:161)
           at java.io.BufferedReader.readLine(BufferedReader.java:324)
           at java.io.BufferedReader.readLine(BufferedReader.java:389)
           at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)
   ```
   with throwable:
   ```
   "Monitor Ctrl-Break"
      java.lang.Thread.State: RUNNABLE
   java.lang.Throwable
   	at java.net.SocketInputStream.socketRead0(Native Method)
   	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
   	at java.net.SocketInputStream.read(SocketInputStream.java:170)
   	at java.net.SocketInputStream.read(SocketInputStream.java:141)
   	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
   	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
   	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
   	at java.io.InputStreamReader.read(InputStreamReader.java:184)
   	at java.io.BufferedReader.fill(BufferedReader.java:161)
   	at java.io.BufferedReader.readLine(BufferedReader.java:324)
   	at java.io.BufferedReader.readLine(BufferedReader.java:389)
   	at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)
   ```
   
   The `java.lang.Throwable` pops up for every thread. It would be better if it looks as one
would expect a thread dump to look like. WDYT?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message