FreeBSD Developers' Handbook
Prev | Chapter 10 Kernel Debugging | Next

# 10.9 Debugging Deadlocks

You may experience so called deadlocks, the situation where a system stops doing useful work. To provide a helpful bug report in this situation, use ddb(4) as described above. Include the output of `ps` and `trace` for suspected processes in the report.

If possible, consider doing further investigation. The receipt below is especially useful if you suspect that a deadlock occurs in the VFS layer. Add the following options

    makeoptions        DEBUG=-g
        options     INVARIANTS
        options     INVARIANT_SUPPORT
        options     WITNESS
        options     DEBUG_LOCKS
        options     DEBUG_VFS_LOCKS
        options     DIAGNOSTIC

to the kernel configuration file. When a deadlock occurs, in addition to the output of the `ps` command, provide information from the `show pcpu`, `show allpcpu`, `show locks`, `show alllocks`, `show lockedvnods` and `alltrace`.

To obtain meaningful backtraces for threaded processes, use `thread thread-id` to switch to the thread stack, and do a backtrace with `where`.

Prev | Home | Next
Debugging a Console Driver | Up | Glossary of Kernel Options for Debugging

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.