You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/10/07 21:39:09 UTC

[GitHub] [helix] pkuwm commented on a change in pull request #1447: Replace Thread.sleep() with TestHelper.verify() to fix the flaky unit tests

pkuwm commented on a change in pull request #1447:
URL: https://github.com/apache/helix/pull/1447#discussion_r501325304



##########
File path: helix-core/src/test/java/org/apache/helix/TestHelper.java
##########
@@ -799,7 +799,12 @@ public static boolean verify(Verifier verifier, long timeout) throws Exception {
     long start = System.currentTimeMillis();
     do {
       boolean result = verifier.verify();
-      if (result || (System.currentTimeMillis() - start) > timeout) {
+      boolean isTimedout = (System.currentTimeMillis() - start) > timeout;
+      if (result || isTimedout) {
+        if (isTimedout && !result) {
+          LOG.error("verifier time out, consider try longer timeout, stack trace{}",
+              Arrays.asList(Thread.currentThread().getStackTrace()));

Review comment:
       The stack trace will be printed in one line with this code. I suggest we use `new throwable().printstacktrace()`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org