[ python-Bugs-857566 ] tempfile.mktemp() omits pid from name
SourceForge.net
noreply at sourceforge.net
Wed Dec 10 09:17:12 EST 2003
Bugs item #857566, was opened at 2003-12-10 13:53
Message generated for change (Comment added) made by ganssauge
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=857566&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Gottfried Ganßauge (ganssauge)
Assigned to: Nobody/Anonymous (nobody)
Summary: tempfile.mktemp() omits pid from name
Initial Comment:
In python2.2 names created using tempfile.mktemp()
contained the current pid as a prefix.
This behaviour has changed and now processes running
concurrently are prone to races.
1.) In my application which forks a few thousand sub
processes over time sometimes tempfiles created by one
subprocess are deleted by another.
2.) Also this probably leads to longer creation times
when two processes want to create a temp file at the
same time on multiprocessor machines because both
processes are using the same rng with the same seed to
generate names.
Sorry, no code here, because 1. happens only a few
times when running with huge amounts of data and
because 2. is only a speculation.
I would propose to reinstate the former behaviour.
----------------------------------------------------------------------
>Comment By: Gottfried Ganßauge (ganssauge)
Date: 2003-12-10 14:17
Message:
Logged In: YES
user_id=792746
This is no option.
In our system we need to spawn another program which
doesn't accept file handles but wants to have a filename
instead.
----------------------------------------------------------------------
Comment By: Thomas Heller (theller)
Date: 2003-12-10 14:04
Message:
Logged In: YES
user_id=11105
mktemp() is deprecated in 2.3, to prevent exactly the
problems you have. Read the docs, and use mkstemp() instead.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=857566&group_id=5470
More information about the Python-bugs-list
mailing list