diff options
author | Greg Hudson <ghudson@mit.edu> | 2024-08-29 15:25:54 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2024-09-11 16:18:39 -0400 |
commit | 1bfcf572241a4ec0e44e609e5c6b7c0b11b08eea (patch) | |
tree | 05b0fd8a6f7e81442d8323c26d24524f86c4e4ca /doc/appdev | |
parent | b9b654e5b469140d5603f27af5bf83ee9a826349 (diff) | |
download | krb5-master.zip krb5-master.tar.gz krb5-master.tar.bz2 |
Library finalizers can run due to the library being unloaded or the
process exiting. If the library is being unloaded, global memory
resources must be released to avoid memory leaks. But if the process
is exiting, releasing memory resources can lead to race conditions if
another thread invokes functions from the library during or after
finalizer execution. Most commonly this manifests as an assertion
error about trying to lock a destroyed mutex.
We can block unloading of our library on ELF platforms by passing "-z
nodelete" to the linker. Add a shell variable "lib_unload_prevented"
to the shlib.conf outputs, set it on platforms where we can block
unloading, and suppress finalizers when it is set.
On Windows we can detect if the process is exiting by checking for a
non-null lpvReserved argument in DllMain(). Do not execute finalizers
when the process is executing.
ticket: 9139 (new)
Diffstat (limited to 'doc/appdev')
0 files changed, 0 insertions, 0 deletions