Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion pages/database-management/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ container, necessary for running debugging tools.
Memgraph supports the following debug capabilities:
1. [Using GDB](#using-gdb): Attaching Memgraph with `GDB` and inspecting threads
2. [Generating a core dump](#generating-core-dump-via-docker) after Memgraph crashed
3. [Using `perf`](#profiling-with-perf) to identify performance bottlenecks
3. [Running Memgraph in GDB inside Docker](#running-memgraph-in-gdb-inside-docker): Directly running Memgraph or MAGE in GDB inside a Docker container.
4. [Using `perf`](#profiling-with-perf) to identify performance bottlenecks


### Using GDB
Expand Down Expand Up @@ -234,6 +235,42 @@ services:
- QUICK_CONNECT_MG_PORT=7687
```

### Running Memgraph in GDB inside Docker


To run Memgraph or MAGE in GDB inside a Docker container, you can use the following
commands to override the entry point and create a bind mount for core dumps:

```bash
# create a directory with sufficient permissions to save the core on the host
mkdir -p cores
chmod 777 cores

# run memgraph via the debug script by overriding the entry point, and creating a bind mount for the core dump
docker run --rm \
--name memgraph \
-v "$(pwd)/cores:/tmp/cores" \
--entrypoint /usr/lib/memgraph/run_with_gdb.sh \
-p 7687:7687 \
memgraph/memgraph:3.7-relwithdebinfo
```

Optionally, the core dump path can be overridden by setting the `CORE_PATH` variable:

```bash
docker run --rm \
--name memgraph \
-v "$(pwd)/cores:/some/other/dir/cores" \
-e CORE_PATH=/some/other/dir/cores/core.dump \
--entrypoint /usr/lib/memgraph/run_with_gdb.sh \
-p 7687:7687 \
memgraph/memgraph:3.7-relwithdebinfo
```

In the case where Memgraph crashes, a core dump will be created in the directory
specified by the `CORE_PATH` variable (`tmp/cores/core` by default) and the full
backtrace will be printed to the terminal.


### Using `heaptrack` with Docker

Expand Down