[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/22972] New: java.io.File#createTempFile returns the same
From: |
pinskia at gcc dot gnu dot org |
Subject: |
[Bug classpath/22972] New: java.io.File#createTempFile returns the same file to different threads |
Date: |
8 Aug 2005 20:13:37 -0000 |
createTempFile uses System.currentTimeMillis() to generate a
temporary file name. So, as the source says itself,
"// XXX - FIXME race condition."
the same file is returned to different threads if they call
createTempFile at the same time.
Using random numbers as Kaffe did before may be safer although
it is not a complete solution, either.
------- Additional Comments From from-classpath at savannah dot gnu dot org
2005-06-04 17:06 -------
Hmm, could this perhaps be fixed simply by making createTempFile synchronized
and adding a 1-millisecond delay?
(I don't think that's likely to be a significant slowdown when you're creating
a file)
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-08
20:13 -------
Confirmed, interesting libjava either have an old version of createTempFile or
a very different
implementation and does not use currentTimeMillis at all.
--
Summary: java.io.File#createTempFile returns the same file to
different threads
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: from-classpath at savannah dot gnu dot org
CC: bug-classpath at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22972
- [Bug classpath/22972] New: java.io.File#createTempFile returns the same file to different threads,
pinskia at gcc dot gnu dot org <=