[New-bugs-announce] [issue23402] dynload_shlib does not close ldl handles when the interpreter is shut down

Adam report at bugs.python.org
Fri Feb 6 19:21:40 CET 2015


New submission from Adam:

I think dynload_shlib (and maybe some of the other non-ldl dynamic library loaders?) should close the libraries when the interpreter is shut down. Currently the handles are not ever closed and in ldl's case sometimes leaked.

The reason I desire this behavior is I have Python opening a shared library that I also open (all within the same process), and I want to be able to reload the library at runtime (via dlclose() + dlopen()) by shutting down the Python interpreter, dlclose()/dlopen(), and re-starting Python on the other side, however having the hanging reference to the library within the interpreter is preventing my dlclose() call from unloading the library.

I have attached a patch for dynload_shlib.c that tracks all handles returned by dlopen() and will close them properly when the interpreter is shut down.

----------
components: Interpreter Core
files: python-dlopen.diff
keywords: patch
messages: 235490
nosy: Adam
priority: normal
severity: normal
status: open
title: dynload_shlib does not close ldl handles when the interpreter is shut down
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file38028/python-dlopen.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23402>
_______________________________________


More information about the New-bugs-announce mailing list