JDK-7037134 : Potential writing to the same log file by multiple processes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2011-04-15
  • Updated: 2014-10-08
  • Resolved: 2014-10-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Duplicate :  
The existing \java.util.logging.FileHandlerimplementation silently ignores 
the IOException thrown by FileChannel.tryLock() when testing with the lock
currently being hold by anyone and assumes that locking is not supported and
proceed without the lock.  There could be potentially two processes writing
to the same log file.

 412                 try {
 413                     FileLock fl = fc.tryLock();
 414                     if (fl == null) {
 415                         // We failed to get the lock.  Try next file.
 416                         continue;
 417                     }
 418                     // We got the lock OK.
 419                 } catch (IOException ix) {
 420                     // We got an IOException while trying to get the lock.
 421                     // This normally indicates that locking is not supported
 422                     // on the target directory.  We have to proceed without
 423                     // getting a lock.   Drop through.
 424                 }

This should have been fixed by JDK-8048020. FileHandler can reuse an existing lock file - but if it fails to lock with IOException, it will fall through and use the file *only* if it created the lock file in the first place. I'm referring to the changes at lines 110-114 in the changeset http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/d41dc1f9b2d8#l1.110