Java Code Examples for org.apache.hadoop.hbase.util.Threads#printThreadInfo()

The following examples show how to use org.apache.hadoop.hbase.util.Threads#printThreadInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HMaster.java    From hbase with Apache License 2.0 6 votes vote down vote up
@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.");
  }
}
 
Example 2
Source File: HRegionServer.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
  LOG.warn("Aborting region server timed out, terminating forcibly" +
      " and does not wait for any running shutdown hooks or finalizers to finish their work." +
      " Thread dump to stdout.");
  Threads.printThreadInfo(System.out, "Zombie HRegionServer");
  Runtime.getRuntime().halt(1);
}
 
Example 3
Source File: AbstractTestDLS.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testThreeRSAbort() throws Exception {
  LOG.info("testThreeRSAbort");
  int numRegionsToCreate = 40;
  int numRowsPerRegion = 100;

  startCluster(NUM_RS); // NUM_RS=6.

  try (Table table = installTable(numRegionsToCreate)) {
    populateDataInTable(numRowsPerRegion);

    List<RegionServerThread> rsts = cluster.getLiveRegionServerThreads();
    assertEquals(NUM_RS, rsts.size());
    cluster.killRegionServer(rsts.get(0).getRegionServer().getServerName());
    cluster.killRegionServer(rsts.get(1).getRegionServer().getServerName());
    cluster.killRegionServer(rsts.get(2).getRegionServer().getServerName());

    TEST_UTIL.waitFor(60000, new Waiter.ExplainingPredicate<Exception>() {

      @Override
      public boolean evaluate() throws Exception {
        return cluster.getLiveRegionServerThreads().size() <= NUM_RS - 3;
      }

      @Override
      public String explainFailure() throws Exception {
        return "Timed out waiting for server aborts.";
      }
    });
    TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
    int rows;
    try {
      rows = TEST_UTIL.countRows(table);
    } catch (Exception e) {
      Threads.printThreadInfo(System.out, "Thread dump before fail");
      throw e;
    }
    assertEquals(numRegionsToCreate * numRowsPerRegion, rows);
  }
}
 
Example 4
Source File: IntegrationTestRpcClient.java    From hbase with Apache License 2.0 5 votes vote down vote up
@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
  }
}
 
Example 5
Source File: HttpServer.java    From hbase with Apache License 2.0 5 votes vote down vote up
@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);
}