JDK-7041595 : add lost test for 6487638
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-05-03
  • Updated: 2011-07-18
  • Resolved: 2011-07-18
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.
JDK 7
7 b143Fixed
Related Reports
Relates :  
Relates :  
Description
While I was looking at Logging API deadlock issues, I happened
to notice that the test for the following bug fix is missing:

6487638 3/3 Calling LogManager.addLogger() and Logger.getLogger() cause deadlock

The above fix should have added the following SDK/JDK test:

    java/util/logging/LoggingDeadlock3.java

I dug around my archives and I found the Serviceability integration
message for JDK7-B14:

------------------------------------------------------------------------------
JPRT Job ID:            2007-05-19-001112.ss45998.sdk7
JPRT System Used:       sfbay
JPRT Version Used:      16 Apr 2007 - National Eggs Benedict Day
Job URL:                http://javaweb.sfbay/jdk/jprt/archive/2007/05/2007-05-19-001112.ss45998.sdk7
User:                   ss45998
Email:                  ###@###.###
Release:                jdk1.7.0
Job Source:             Teamware: /net/tomsk.sfbay/export/home/ss45998/1.5/sdk7/{make,src}
Parent:                 /java/svc/ws/j2se/service_sdk_baseline
File List:              {src/share/classes/java/util/logging/LogManager.java,src/share/classes/java/util/logging/Logger.java,test/java/util/logging/LoggingDeadlock3.java,test/java/util/logging/LoggingDeadlock3.props}
Command Line:           jprt submit -w /net/tomsk.sfbay/export/home/ss45998/1.5/sdk7 -p /java/svc/ws/j2se/service_sdk_baseline -email ###@###.### -m /home/ss45998/jpdaWork/fix/comment_file.lmd3 -release jdk1.7.0 -cr 6487638 src/share/classes/java/util/logging/LogManager.java src/share/classes/java/util/logging/Logger.java test/java/util/logging/LoggingDeadlock3.java test/java/util/logging/LoggingDeadlock3.props
------------------------------------------------------------------------------

Fixed 6487638: Calling LogManager.addLogger() and Logger.getLogger() cause deadlock [Tim Bell]

Webrev:
     http://javaweb.sfbay/~ss45998/webrev/2007/lmd3.May10

Problem:
  This is another deadlock issue in the logging API
  which was in the implementation from the beginning.
  The following two public methods can be called from different threads concurrently:
    - synchronized instance method LogManager.addLogger()
    - synchronized static method Logger.getLogger()

  The following deadlocking scenario is possible:
  T1:
    Locks the LogManager object, calls LogManager.addLogger() which calls
    Logger.getLogger() which is waiting to lock the Logger Class object.

  T2:
    Locks the Logger Class object, calls Logger.getLogger() which calls
    LogManager.getLogger() which is waiting to lock the LogManager object.

Solution:
    The fix is to remove this bad cyclic dependency between the
    LogManager and Logger classes.

Approved by: No approval is needed

Reviewed by:
  Tim Bell

Fix verified (y/n): y
  New regression test:
    java/util/logging/LoggingDeadlock3.java

Verification testing:
  All the java.util.logging nsk, jtreg and jck tests.

Other testing:
  JPRT


------------------------------------------------------------------------------

Files:
update: src/share/classes/java/util/logging/LogManager.java
update: src/share/classes/java/util/logging/Logger.java

Examined files: 2

Contents Summary:
       2   update


The teamware command log shows that:

    test/java/util/logging/LoggingDeadlock3.java
    test/java/util/logging/LoggingDeadlock3.props

were both named on the command line, but the "Files:"
part of the log does not show "create:" entries for
those two files. I'm going to guess that Serguei forgot
to do an "sccs create" on the files.

I found both files in the webrev attached to 6487638,
removed all the HTML stuff, and I'm attaching the files
to this bug.

Comments
EVALUATION Changeset: 9861df231e9e Author: dcubed Date: 2011-05-16 12:58 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/9861df231e9e 7041595: 4/4 add lost test for 6487638 Summary: Add missing LoggingDeadlock3.java and LoggingDeadlock3.props Reviewed-by: dsamersoff, never, acorn, mchung + test/java/util/logging/LoggingDeadlock3.java + test/java/util/logging/LoggingDeadlock3.props
16-05-2011

SUGGESTED FIX See 6977677 for this fix in webrev format.
16-05-2011

SUGGESTED FIX Here are the context diffs for minor editorial changes made relative to the attachments during the review of this fix: 65,66c65,66 < if (cnt%1000 == 0) out.print("1"); < if (cnt%10000 == 0) out.println(); --- > if (cnt % 1000 == 0) out.print("1"); > if (cnt % 10000 == 0) out.println(); 76,77c76,77 < if (cnt%100 == 0) out.print("2"); < if (cnt%1000 == 0) out.println(); --- > if (cnt % 100 == 0) out.print("2"); > if (cnt % 1000 == 0) out.println();
16-05-2011

EVALUATION Add the attached tests to the SDK/JDK tests for java/util/logging.
03-05-2011