This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: UNIX mmap leaks file descriptors
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: drylock, nnorwitz
Priority: normal Keywords:

Created on 2005-11-01 03:46 by drylock, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
t.py drylock, 2005-11-01 03:46 Test case
Messages (2)
msg26771 - (view) Author: Erwin S. Andreasen (drylock) Date: 2005-11-01 03:46
The commit from 2.49 to 2.50 in Modules/mmapmodule.c
has made mmap under UNIX leak a file descriptor:

-       m_obj->fd = fd;
+       m_obj->fd = dup(fd);

The FD given is dup'ed in order to allow ftruncation
later, but no close of it is done in dealloc/close.

A test case attached, using lsof after some
mmaps/unmaps to show leak.

Version:

Python 2.4.2 (#2, Sep 29 2005, 00:23:59) 
[GCC 4.0.2 (Debian 4.0.1-9)] on linux2
msg26772 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-11-02 05:46
Logged In: YES 
user_id=33168

Thanks!

Committed revision 41366.
Committed revision 41367. (cleanup)
Committed revision 41368. (2.4)
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42538
2005-11-01 03:46:21drylockcreate