Berkeley DB Reference Guide: Programmer Notes
Полезная информация

Berkeley DB Reference Guide: Programmer Notes

Application signal handling

When applications using Berkeley DB receive signals, it is important that they exit gracefully, discarding any Berkeley DB locks that they may hold. This is normally done by setting a flag when a signal arrives, and then checking for that flag periodically within the application. As Berkeley DB is not reentrant, the signal handler should not attempt to release locks and/or close the database handles itself if there is any question at all that Berkeley DB can be reentered. Reentering Berkeley DB is not guaranteed to work correctly and the results are undefined.

If an application exits holding a lock, the situation is no different than if the application crashed, and all applications participating in the database environment must be shutdown, and then recovery must be performed. If this is not done, the locks that the application held can cause unresolvable deadlocks inside the database, and applications may then hang.