DBeaver Documentation

DOWNLOAD pdf

Making a thread dump

Overview

Sometimes (due to some bug) DBeaver UI hangs, freezes, or works incorrectly. It is usually impossible to find the reason for such an issue without a thread dump. A thread dump is information about the internal execution state of the Java program.

DBeaver incorporates the jstack tool for generating thread dumps. To use this pre-installed tool, it is essential to locate its directory in the DBeaver installation and execute it from there.

Important: The jstack tool is not included in the tar.gz without Java on the DBeaver download page, and in Downstream packages.

Finding jstack

The location of jstack varies depending on your operating system:

For macOS and Linux

  • Find the directory where DBeaver is installed. On macOS, proceed to the Contents/Eclipse subdirectory. Then, in both macOS and Linux systems, locate the jre/bin/jstack directory. This is the typical location for jstack in DBeaver installations.

For Windows

  • Find the directory where DBeaver is installed.
  • Within this directory, go to jre/bin/jstack.exe. This is the standard path to find jstack in DBeaver installations on Windows systems.

Note: If you did not install Java during the DBeaver installation (by unchecking the Install Java checkbox), jstack.exe will not be present. In this case, you need to install Java separately and locate jstack.exe within the Java installation directory.

Generating a thread dump on Windows

To create a thread dump in DBeaver on Windows, follow these steps:

  1. Find DBeaver's Process ID:

    • Open Task Manager by pressing CTRL+SHIFT+ESC.
    • In Windows 8 and later, switch to the "Details" tab.
    • Locate DBeaver (or DBeaver[your version]) in the process list and note its process ID (PID).

    > Tip: For example, if you are using the DBeaver Lite version, you should look for DBeaverLite.

  2. Open Command Prompt:

    • Press Win+R, type cmd, and press ENTER to open the command prompt.
  3. Run the Thread Dump command:

    • Navigate to the jre/bin directory within the DBeaver installation path.
    • Run the following command, replacing PID with the actual process ID of DBeaver: `cmd jstack.exe PID > "%HOMEPATH%\dbeaver-thread-dump.txt" `
    • This command executes jstack.exe, generates a thread dump for the specified PID, and saves the output to dbeaver-thread-dump.txt in your home directory (e.g., C:\Users\Username). This file contains the thread dump information that can be attached to a GitHub issue for further analysis.

Generating a thread dump on Mac and Linux

To create a thread dump in DBeaver on macOS and Linux systems, you can use the included jstack tool via the terminal. The following script will generate a thread dump and save it as dbeaver-thread-dump.txt in your home directory:

/Applications/YOUR-VERSION-OF-DBEAVER.app/Contents/Eclipse/jre/Contents/Home/bin/jstack $(pgrep dbeaver) > ~/dbeaver-thread-dump.txt

Tip: Replace YOUR-VERSION-OF-DBEAVER.app with the version of DBeaver you have installed. For example, if you have DBeaver Lite version, the path would be /Applications/DBeaverLite.app/Contents/Eclipse/jre/Contents/Home/bin/jstack.

Generating a thread dump without Java

For Linux users

If you are running DBeaver on Linux using the tar.gz version without Java included, you will need to install the Java Development Kit (JDK) to generate a thread dump. Follow these steps:

  1. Check for Existing JDK Installation:

    • Open your terminal.
    • Type which jstack and press Enter.
    • If the JDK is installed, a version number will appear.
  2. Install JDK:

    • If JDK is not installed, you need to install it.
    • Use your distribution's package manager to install JDK. For example, on Ubuntu, you can use sudo apt install default-jdk.

After successfully installing JDK, proceed with the thread dump script:

jstack $(pgrep dbeaver) > ~/dbeaver-thread-dump.txt

After running this script, you will find the dbeaver-thread-dump.txt file in your home directory, containing the necessary thread information for diagnosing issues.

For Windows users

If you are using DBeaver on Windows without Java, consider installing Adoptium OpenJDK.

Alternatively, you can reinstall DBeaver and ensure to check the Install Java checkbox during installation.

After installing Java through either method, you can follow the instructions in the section Generating a Thread Dump on Windows to successfully generate a thread dump.