java.lang.Object
net.i2p.router.tasks.ThreadDump

abstract class ThreadDumpextends Object
Thread dump utility for debugging hung router instances.

This class provides functionality to request Java Service Wrapper to dump all thread stacks to wrapper.log file. This is essential for diagnosing router hangs, deadlocks, or performance issues.

Platform Requirements:

  • Requires Java Service Wrapper to be installed and running
  • Only works on non-Windows platforms (Linux, macOS, Unix)
  • Does not function on Windows due to wrapper limitations

The dump operation is asynchronous - this method signals the wrapper to start the dump but does not wait for it to complete. The actual thread dump will appear in wrapper.log shortly after the call returns.

This utility is typically called by the watchdog when router appears to be unresponsive, but can also be invoked manually for debugging.

  • Constructor Details

    • ThreadDump

      private ThreadDump()
      Utility class, not intended for instantiation.
  • Method Details

    • dump

      public static boolean dump(I2PAppContext context, int secondsToWait)
      Signal the wrapper to asynchronously dump threads to wrapper.log.

      This method sends a signal to the Java Service Wrapper to dump all thread stacks to the wrapper log file. This is useful for debugging hung or unresponsive router instances.

      The method waits for the signal to be sent (which should be fast) but does not wait for the actual thread dump to complete.

      Note: Only works on non-Windows platforms with the Java Service Wrapper.

      Parameters:
      context - the I2P application context for accessing directories
      secondsToWait - maximum seconds to wait for the signal to complete; if <= 0, don't wait for completion
      Returns:
      true if successful, false in the following cases: - Windows platform or no wrapper available - secondsToWait > 0 and operation timed out - signal failed for other reasons