JDK-7167647 : [macosx] Posix semaphore leak in ColorSpace
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-05-09
  • Updated: 2012-06-20
  • Resolved: 2012-06-20
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 8
8Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin euler.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
Calling toRGB() on a CIEXYZ ColorSpace leaks Posix semaphores and exhausts system files.

REGRESSION.  Last worked in version 6u31

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put the following code in a file named Test.java:

    import java.awt.color.ColorSpace;
    public class Test
    {
        public static void main(String[] args) throws Throwable {
            final ColorSpace CIEXYZ = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);
            for(int i = 0; i < 100000; i++) {
                CIEXYZ.toRGB(new float[] {80f, 100, 100});
            }
            new java.io.FileInputStream("Test.java").close();
        }
    }

Run javac Test.java
Run java Test


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program shouldn't output anthing
ACTUAL -
Exception in thread "main" java.io.FileNotFoundException: Test.java (Too many open files)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:97)
	at Test.main(Test.java:9)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.io.FileNotFoundException: Test.java (Too many open files)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:97)
	at Test.main(Test.java:9)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
    import java.awt.color.ColorSpace;
    public class Test
    {
        public static void main(String[] args) throws Throwable {
            final ColorSpace CIEXYZ = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);
            for(int i = 0; i < 100000; i++) {
                CIEXYZ.toRGB(new float[] {80f, 100, 100});
            }
            // Should be an existing file
            new java.io.FileInputStream("Test.java").close();
        }
    }

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None found if you need CIEXYZ support.