[New-bugs-announce] [issue19444] mmap.mmap() allocates a file descriptor that isn't CLOEXEC

Robert Merrill report at bugs.python.org
Wed Oct 30 06:19:09 CET 2013


New submission from Robert Merrill:

Same code but different problem as this issue: http://bugs.python.org/issue10897

The above-linked issue was closed as WONTFIX, but there is a secondary problem: the file descriptor that mmap.mmap() allocates is not set to close-on-exec.

This means that any process you spawn using os.system() and the like, its children, its children's children etc will inherit this file descriptor.

This is unexpected, unnecessary behavior, and potentially a huge pain if you mmap() a file and then spawn, say, inetd or something that does similar stuff, because now you have to kill every process that spawned from that in order to unmount filesystems or remove kernel modules that are being blocked as a result of the fds being open.

----------
components: Library (Lib)
messages: 201709
nosy: rfm
priority: normal
severity: normal
status: open
title: mmap.mmap() allocates a file descriptor that isn't CLOEXEC
type: resource usage
versions: Python 2.7

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


More information about the New-bugs-announce mailing list