-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 13, 14
-
b18
-
generic
-
linux
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8245636 | 13.0.4 | Severin Gehwolf | P4 | Resolved | Fixed | b02 |
JDK-8236471 | 11.0.7-oracle | Ivan Gerasimov | P4 | Resolved | Fixed | b01 |
JDK-8235494 | 11.0.7 | Severin Gehwolf | P4 | Resolved | Fixed | b01 |
JDK-8236805 | openjdk8u252 | Severin Gehwolf | P4 | Resolved | Fixed | b01 |
JDK-8236473 | 8u251 | Ivan Gerasimov | P4 | Resolved | Fixed | b01 |
JDK-8239710 | emb-8u251 | Severin Gehwolf | P4 | Resolved | Fixed | team |
JDK-8236474 | 7u261 | Ivan Gerasimov | P4 | Resolved | Fixed | b01 |
JDK-8240056 | openjdk7u | Severin Gehwolf | P4 | Resolved | Fixed | master |
public static Path write(Path path, Iterable<? extends CharSequence> lines,
Charset cs, OpenOption... options)
throws IOException
{
// ensure lines is not null before opening file
Objects.requireNonNull(lines);
CharsetEncoder encoder = cs.newEncoder();
OutputStream out = newOutputStream(path, options);
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
for (CharSequence line: lines) {
writer.append(line);
writer.newLine();
}
}
return path;
}
Even though the Javadoc says that the file descriptors are properly closed, the OutputStream fd is being leaked in case of Exceptions.
In order to reproduce on Linux do the following:
As root:
$ mkdir /mnt/tmpfs
$ mount -t tmpfs none -o size=4096 /mnt/tmpfs/
Then as regular user do:
$ cd /mnt/tmpfs
$ java Reproducer
In a separate terminal observe:
$ jps | grep Reproducer
31423 Reproducer
$ lsof -p 31423 | grep /mnt/tmpfs/foo | wc -l
92671
It's expected that there is only one file descriptor pointing to /mnt/tmpfs/foo, not many.
Depending on 'ulimit -n' setting the reproducer might behave slightly different.
- backported by
-
JDK-8235494 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8236471 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8236473 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8236474 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8236805 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8239710 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8240056 (fs) Files.write can leak file descriptor in the exception case
- Resolved
-
JDK-8245636 (fs) Files.write can leak file descriptor in the exception case
- Resolved