@Override public void run() { LOG.warn("Aborting region server timed out, terminating forcibly. Thread dump to stdout."); Threads.printThreadInfo(System.out, "Zombie HRegionServer"); System.exit(1); } }
/** * @param t Waits on the passed thread to die dumping a threaddump every * minute while its up. * @throws InterruptedException */ public static void threadDumpingIsAlive(final Thread t) throws InterruptedException { if (t == null) { return; } while (t.isAlive()) { t.join(60 * 1000); if (t.isAlive()) { printThreadInfo(System.out, "Automatic Stack Trace every 60 seconds waiting on " + t.getName()); } } }
/** * Utility method to wait some time for an event to occur, and then return control to the caller. * @param millis How long to wait, in milliseconds. * @param action The action that we are waiting for. Will be used in log message if the event * does not occur. * @param check A Supplier that will be checked periodically to produce an updated true/false * result indicating if the expected event has happened or not. * @throws InterruptedIOException If we are interrupted while waiting for the event. * @throws RuntimeException If we reach the specified timeout while waiting for the event. */ private static void waitForEvent(long millis, String action, Supplier<Boolean> check) throws InterruptedIOException { long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(millis); while (true) { if (check.get()) { return; } if (System.nanoTime() > end) { String msg = "Master not " + action + " after " + millis + "ms"; Threads.printThreadInfo(System.out, "Thread dump because: " + msg); throw new RuntimeException(msg); } try { Thread.sleep(100); } catch (InterruptedException e) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } } }
@Override public void run() { try { Thread.sleep(timeout); Threads.printThreadInfo(System.err, "TEST TIMEOUT STACK DUMP"); System.exit(1); // a timeout happened } catch (InterruptedException e) { // this is what we want } }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) { return; } response.setContentType("text/plain; charset=UTF-8"); try (PrintStream out = new PrintStream( response.getOutputStream(), false, "UTF-8")) { Threads.printThreadInfo(out, ""); out.flush(); } ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1); } }
@Override public void run() { try { while (!master.isStopped() && master.isActiveMaster()) { Thread.sleep(timeout); if (master.isInitialized()) { LOG.debug("Initialization completed within allotted tolerance. Monitor exiting."); } else { LOG.error("Master failed to complete initialization after " + timeout + "ms. Please" + " consider submitting a bug report including a thread dump of this process."); if (haltOnTimeout) { LOG.error("Zombie Master exiting. Thread dump to stdout"); Threads.printThreadInfo(System.out, "Zombie HMaster"); System.exit(-1); } } } } catch (InterruptedException ie) { LOG.trace("InitMonitor thread interrupted. Existing."); } } }
out.flush(); PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8"); Threads.printThreadInfo(ps, ""); ps.flush();
out.println(LINE); PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8"); Threads.printThreadInfo(ps, ""); ps.flush();
"if > 3 attempts: i=" + i); if (i > 3) { Threads.printThreadInfo(System.out, "Thread dump " + t.getName());
rows = TEST_UTIL.countRows(table); } catch (Exception e) { Threads.printThreadInfo(System.out, "Thread dump before fail"); throw e;
/** * @param t Waits on the passed thread to die dumping a threaddump every * minute while its up. * @throws InterruptedException */ public static void threadDumpingIsAlive(final Thread t) throws InterruptedException { if (t == null) { return; } while (t.isAlive()) { t.join(60 * 1000); if (t.isAlive()) { printThreadInfo(System.out, "Automatic Stack Trace every 60 seconds waiting on " + t.getName()); } } }
/** * @param t Waits on the passed thread to die dumping a threaddump every * minute while its up. * @throws InterruptedException */ public static void threadDumpingIsAlive(final Thread t) throws InterruptedException { if (t == null) { return; } while (t.isAlive()) { t.join(60 * 1000); if (t.isAlive()) { printThreadInfo(System.out, "Automatic Stack Trace every 60 seconds waiting on " + t.getName()); } } }
/** * @param t Waits on the passed thread to die dumping a threaddump every * minute while its up. * @throws InterruptedException */ public static void threadDumpingIsAlive(final Thread t) throws InterruptedException { if (t == null) { return; } while (t.isAlive()) { t.join(60 * 1000); if (t.isAlive()) { printThreadInfo(System.out, "Automatic Stack Trace every 60 seconds waiting on " + t.getName()); } } }
@Override public void run() { try { Thread.sleep(timeout); Threads.printThreadInfo(System.err, "TEST TIMEOUT STACK DUMP"); System.exit(1); // a timeout happened } catch (InterruptedException e) { // this is what we want } }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) { return; } response.setContentType("text/plain; charset=UTF-8"); try (PrintStream out = new PrintStream( response.getOutputStream(), false, "UTF-8")) { Threads.printThreadInfo(out, ""); out.flush(); } ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1); } }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) { return; } response.setContentType("text/plain; charset=UTF-8"); try (PrintStream out = new PrintStream( response.getOutputStream(), false, "UTF-8")) { Threads.printThreadInfo(out, ""); out.flush(); } ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1); } }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) { return; } response.setContentType("text/plain; charset=UTF-8"); try (PrintStream out = new PrintStream( response.getOutputStream(), false, "UTF-8")) { Threads.printThreadInfo(out, ""); out.flush(); } ReflectionUtils.logThreadInfo(LOG, "jsp requested", 1); } }
out.println(LINE); PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8"); Threads.printThreadInfo(ps, ""); ps.flush();
@Override public void run() { try { while (!master.isStopped() && master.isActiveMaster()) { Thread.sleep(timeout); if (master.isInitialized()) { LOG.debug("Initialization completed within allotted tolerance. Monitor exiting."); } else { LOG.error("Master failed to complete initialization after " + timeout + "ms. Please" + " consider submitting a bug report including a thread dump of this process."); if (haltOnTimeout) { LOG.error("Zombie Master exiting. Thread dump to stdout"); Threads.printThreadInfo(System.out, "Zombie HMaster"); System.exit(-1); } } } } catch (InterruptedException ie) { LOG.trace("InitMonitor thread interrupted. Existing."); } } }
rows = TEST_UTIL.countRows(table); } catch (Exception e) { Threads.printThreadInfo(System.out, "Thread dump before fail"); throw e;