2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB: db_deadlock</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
18
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
22
<h3><pre>db_deadlock [<b>-Vv</b>]
23
[<b>-a e | m | n | o | w | y</b>] [<b>-h home</b>] [<b>-L file</b>] [<b>-t sec.usec</b>]</pre></h3>
25
<a name="3"><!--meow--></a>
26
<p>The db_deadlock utility traverses the database environment lock
27
region, and aborts a lock request each time it detects a deadlock or a
28
lock request that has timed out. By default, in the case of a deadlock,
29
a random lock request is chosen to be aborted.
30
<p>This utility should be run as a background daemon, or the underlying
31
Berkeley DB deadlock detection interfaces should be called in some other way,
32
whenever there are multiple threads or processes accessing a database
33
and at least one of them is modifying it.
34
<p>The options are as follows:
36
<p><dt><b>-a</b><dd>When a deadlock is detected, abort the locker:
38
<p><dt>m<dd>with the greatest number of locks
39
<dt>n<dd>with the fewest number of locks
40
<dt>o<dd>with the oldest locker ID
41
<dt>w<dd>with the fewest number of write locks
42
<dt>y<dd>with the youngest locker ID
44
<p>When lock or transaction timeouts have been specified:
46
<p><dt>e<dd>abort any lock request that has timed out
48
<p><dt><b>-h</b><dd>Specify a home directory for the database environment; by
49
default, the current working directory is used.
50
<p><dt><b>-L</b><dd>Log the execution of the db_deadlock utility to the specified file in the
51
following format, where <i>###</i> is the process ID, and the date
52
is the time the utility was started.
53
<p><blockquote><pre>db_deadlock: ### Wed Jun 15 01:23:45 EDT 1995</pre></blockquote>
54
This file will be removed if the db_deadlock utility exits gracefully.
55
<p><dt><b>-t</b><dd>Check the database environment every <b>sec</b> seconds plus
56
<b>usec</b> microseconds to see if a process has been forced to wait
57
for a lock; if one has, review the database environment lock
59
<p><dt><b>-V</b><dd>Write the library version number to the standard output, and exit.
60
<p><dt><b>-v</b><dd>Run in verbose mode, generating messages each time the detector runs.
62
<p>If the <b>-t</b> option is not specified, db_deadlock will
64
<p>The db_deadlock utility uses a Berkeley DB environment (as described for the
65
<b>-h</b> option, the environment variable <b>DB_HOME</b>, or
66
because the utility was run in a directory containing a Berkeley DB
67
environment). In order to avoid environment corruption when using a
68
Berkeley DB environment, db_deadlock should always be given the chance to
69
detach from the environment and exit gracefully. To cause db_deadlock
70
to release all environment resources and exit cleanly, send it an
71
interrupt signal (SIGINT).
72
<p>The db_deadlock utility does not attempt to create the Berkeley DB
73
shared memory regions if they do not already exist. The application
74
which creates the region should be started first, and then, once the
75
region is created, the db_deadlock utility should be started.
76
<p>The <a href="../api_c/lock_detect.html">DB_ENV->lock_detect</a> method is the underlying interface used by the db_deadlock utility.
77
See the db_deadlock utility source code for an example of using <a href="../api_c/lock_detect.html">DB_ENV->lock_detect</a>
78
in a IEEE/ANSI Std 1003.1 (POSIX) environment.
79
<p>The db_deadlock utility exits 0 on success, and >0 if an error occurs.
80
<h1>Environment Variables</h1>
82
<p><dt>DB_HOME<dd>If the <b>-h</b> option is not specified and the environment variable
83
DB_HOME is set, it is used as the path of the database home, as described
84
in <a href="../api_c/env_open.html">DB_ENV->open</a>.
87
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>