Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1058482 - tmpwatch removes python multiprocessing sockets
Summary: tmpwatch removes python multiprocessing sockets
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python
Version: 7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Matej Stuchlik
QA Contact: Filip Holec
Depends On:
Blocks: 1058310
TreeView+ depends on / blocked
Reported: 2014-01-27 21:21 UTC by Miloslav Trmač
Modified: 2016-04-18 10:27 UTC (History)
9 users (show)

Fixed In Version: python-2.7.5-29.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1058310
Last Closed: 2015-11-19 12:42:08 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2101 normal SHIPPED_LIVE Moderate: python security, bug fix, and enhancement update 2015-11-19 11:04:15 UTC

Description Miloslav Trmač 2014-01-27 21:21:42 UTC
systemd maintainers: Please add an exclusion equivalent to attachment #867073 to tmpfiles.d , which has replaced the tmpwatch cron.daily script in RHEL-7.

(For #678161 you wanted to move this to a more specific package, but every installation includes Python due to yum/dnf, so adding an extra file to the Python interpreter instead of adding it to the main tmp.conf would be pointless overhead IMHO; if you disagree, feel free to reassign.)

+++ This bug was initially created as a clone of Bug #1058310 +++

Description of problem:

The Python multiprocessing library ( can open an ephemeral socket for interprocess communication based on a temporary file.  It creates these temp files in /tmp/pymp-XXXXXX.  However, the atomic temp file creation does not ever list the directory, so its atime is not updated.  However, the pymp-* directory is only generated once, when the program is started.

As a result, if a Python program runs for more than ten days (the default cleanup time for /tmp in /etc/cron.d/tmpwatch), creates sockets (e.g., with multiprocessing.connnection.Listener()), and has no open sockets when tmpwatch runs, the pymp-* directory will be removed, and the next time the Python program attempts to open a socket it will fail spectacularly.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce: is attached.  Run:

./ 864010 & sleep 864005; bash /etc/cron.daily/tmpwatch

This takes ten days to run, so if you want something quicker, you can run:

./ 70 & sleep 65;/usr/sbin/tmpwatch -x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix         -x /tmp/.ICE-unix -x /tmp/.Test-unix 1m /tmp

The tmpwatch command there is taken directly from the stock /etc/cron.daily/tmpwatch, with '240' (hours) changed to '1m' so that this can be run in a timely fashion.

Actual results:

% ./ 70 & sleep 65;/usr/sbin/tmpwatch -x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix         -x /tmp/.ICE-unix -x /tmp/.Test-unix 1m /tmp
[1] 7361
Traceback (most recent call last):
  File "./", line 19, in <module>
  File "./", line 15, in main
    l = Listener()
  File "/usr/lib64/python2.6/multiprocessing/", line 106, in __init__
    self._listener = SocketListener(address, family, backlog)
  File "/usr/lib64/python2.6/multiprocessing/", line 227, in __init__
  File "<string>", line 1, in bind
socket.error: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/usr/lib64/python2.6/multiprocessing/", line 235, in _run_finalizers
  File "/usr/lib64/python2.6/multiprocessing/", line 174, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/usr/lib64/python2.6/", line 204, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib64/python2.6/", line 202, in rmtree
    names = os.listdir(path)
OSError: [Errno 2] No such file or directory: '/tmp/pymp-oki8QE'

Expected results:

The file names of two temp files should be printed.

Additional info:

--- Additional comment from Chris St. Pierre on 2014-01-27 08:50:35 EST ---

A patch for /etc/cron.d/tmpwatch that fixes the issue is attached.

--- Additional comment from Miloslav Trmač on 2014-01-27 16:17:10 EST ---

Thanks for your report and the patch.

I'm not... thrilled... about the way multiprocessing uses the temporary directory, but we have a precedent in doing the same for bug #527425 .

Needs to be fixed for RHEL 7 first, though, to avoid a regression on update,

Comment 2 Lukáš Nykrýn 2014-01-31 11:52:43 UTC
I think that putting that drop-in into the package which really needs it is a nicer solution.

Comment 4 Bohuslav "Slavek" Kabrda 2015-04-27 12:25:00 UTC
The solution is straightforward here, dev_ack+

Comment 11 errata-xmlrpc 2015-11-19 12:42:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

Note You need to log in before you can comment on or make changes to this bug.