Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/5718
  
    This change appears to be focus mostly around Travis which i dislike a bit. 
    I'd rather add a custom `Timeout` that prints the thread-dump so we still 
get nice behavior when running things locally/in the IDE.
    
    ```
        @Rule
        public final Timeout timeout = new MyTimeOut(10, TimeUnit.MILLISECONDS);
    
        public static class MyTimeOut extends Timeout {
    
                public MyTimeOut(long timeout, TimeUnit timeUnit) {
                        super(timeout, timeUnit);
                }
    
                @Override
                public Statement apply(Statement base, Description description) 
{
                        Statement fail = super.apply(base, description);
                        return new Statement() {
                                @Override
                                public void evaluate() throws Throwable {
                                        
System.out.println(crunchifyGenerateThreadDump());
                                        fail.evaluate();
                                }
                        };
                }
        }
    
        public static String crunchifyGenerateThreadDump() {
                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("\n   java.lang.Thread.State: ");
                        dump.append(state);
                        final StackTraceElement[] stackTraceElements = 
threadInfo.getStackTrace();
                        for (final StackTraceElement stackTraceElement : 
stackTraceElements) {
                                dump.append("\n        at ");
                                dump.append(stackTraceElement);
                        }
                        dump.append("\n\n");
                }
                return dump.toString();
        }
    ```


---

Reply via email to