---
name: "db_deadlock"
section: "1db"
platform: "linux"
package: "libdb2-util"
version: "2:2.4.14-2.7.7.1.c"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/db_deadlock/1db"
---

# db\_deadlock(1db)

the DB database deadlock detector

## NAME

db\_deadlock - the DB database deadlock detector

## SYNOPSIS

```
db_deadlock [-vw] [-a m | o | y] [-h home]
 [-L file ] [-t sec ]
```

## DESCRIPTION

The *db\_deadlock* utility traverses the database lock structures and aborts a transaction each time it detects a deadlock. This utility should be run as a background daemon whenever multiple threads or processes are using locking. By default, a random transaction involved in the deadlock is aborted.

The options are as follows:

- **-a**

  When a deadlock is detected, abort the oldest (\`\`o'') transaction, the youngest (\`\`y'') transaction, or the transaction with the minimum number of locks (\`\`m'').

- **-h**

  Specify a home directory for the database.

- **-L**

  Log the execution of the db\_deadlock utility to the specified file in the following format, where \`\`###'' is the process ID, and the date is the time the utility starting running.

  db\_deadlock: ### Wed Jun 15 01:23:45 EDT 1995

  This file will be removed if the db\_deadlock utility exits gracefully.

- **-t**

  Initiate a pass over the database locks at least every *sec* seconds.

- **-v**

  Run in verbose mode, generating messages each time the detector runs.

- **-w**

  Make a single pass over the database locks every time a process is forced to wait for a lock.

At least one of the **-t** and **-w** options must be specified.

The *db\_deadlock* utility attaches to DB shared memory regions. In order to avoid region corruption, it should always be given the chance to detach and exit gracefully. To cause *db\_deadlock* to clean up after itself and exit, send it an interrupt signal (SIGINT).

The *db\_deadlock* utility exits 0 on success, and \>0 if an error occurs.

## ENVIRONMENT VARIABLES

The following environment variables affect the execution of *db\_deadlock*:

- DB\_HOME

  If the **-h** option is not specified and the environment variable *DB\_HOME* is set, it is used as the path of the database home, as described in *db\_appinit*(3).

## SEE ALSO

The DB library is a family of groups of functions that provides a modular programming interface to transactions and record-oriented file access. The library includes support for transactions, locking, logging and file page caching, as well as various indexed access methods. Many of the functional groups (e.g., the file page caching functions) are useful independent of the other DB functions, although some functional groups are explicitly based on other functional groups (e.g., transactions and logging). For a general description of the DB package, see *db\_intro*(3).

[*db\_archive*(1)](/db_archive/1.md), [*db\_checkpoint*(1)](/db_checkpoint/1.md), [*db\_deadlock*(1)](/db_deadlock/1.md), [*db\_dump*(1)](/db_dump/1.md), [*db\_load*(1)](/db_load/1.md), [*db\_recover*(1)](/db_recover/1.md), [*db\_stat*(1)](/db_stat/1.md),
