← Back to team overview

openjdk team mailing list archive

[Bug 913434]

 

This is a multi-threading problem with LCMS version 2.5. It was claimed to have been fixed with LCMS v2.6, but many OS are still running the older packages.  I have code that parses PDF files. It is running in a production environment on random PDF files and with lots of threads. I was able to stop the error (~2 years ago) by adding "syncronized" keyword around the following block of java code:
   ICC_Profile profile = ICC_Profile.getInstance(byte[]);
   ICC_ColorSpace colorSpace = new ICC_ColorSpace(profile);
   int numComponents = 3;  // From PDF dictionary, typically '3' (RGB).
   float[] components = new float[numComponents];

   // Test that ICC_Profile can be parsed
   // Generates an exception on malformed byte[]
   // Crashes JVM sporadically if not forced inline by 'syncronized'
   new java.awt.Color(colorSpace,components,1f);


If it helps, here's my java method (won't compile as it is missing methods):
	public static synchronized PDFColorSpace getICCColorSpace(PDFToken dict) throws IOException {
		PDFColorSpace cs=null;
		PDFToken nToken = dict.getDictionaryItem(N);
		int numComponents = (nToken==null) ? 1 : nToken.getInteger();

		try {			
			
			ICC_Profile profile = ICC_Profile.getInstance(dict.getStream().toString8().getBytes());
			
			// This does not prevent JVM Crash with BELL.SW
			// if (profile.getNumComponents() == numComponents) ...
			
			ICC_ColorSpace colorSpace = new ICC_ColorSpace(profile);
			cs = new NativeColorSpace(TypeICC,colorSpace);
							
			// Test if ICC_Profile is OK. Will throw Exception (or even crash the JVM)
			//   eg: Cik#99001898, http://www.siemens.com/investor/pool/de/investor_relations/events/hauptversammlung/2012/dividendenbekanntmachung.pdf, pg0
			//   eg: JVM Crash, Cik#99002137, BELL.SW
			float[] components = new float[numComponents];
			new java.awt.Color(colorSpace,components,1f);
			
		} catch (Exception e) {
			cs=null;
		}
        return cs;
      }

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-7 in Ubuntu.
https://bugs.launchpad.net/bugs/913434

Title:
  ImageIO crashes (core dumped) while reading many image files

Status in OpenJDK:
  Confirmed
Status in lcms2 package in Ubuntu:
  Incomplete
Status in openjdk-7 package in Ubuntu:
  Incomplete

Bug description:
  Code that uses ImageIO.read() to read many image files (on my system:
  270 files, totalling 522.9 MiB) crashes the JVM.

  ~~~ My system information:

  $ lsb_release -a
  No LSB modules are available.
  Distributor ID:	Ubuntu
  Description:	Ubuntu 11.10
  Release:	11.10
  Codename:	oneiric

  $ uname -a
  Linux dowah 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

  $ javac -version
  javac 1.7.0_147

  $ java -version
  java version "1.7.0_147-icedtea"

  ~~~ To reproduce the error:

  $ javac BugIIO.java

  $ ulimit -c unlimited # to enable core dump

  $ java BugIIO

  ~~~ Terminal output that signifies the error:

  #
  # A fatal error has been detected by the Java Runtime Environment:
  #
  #  SIGSEGV (0xb) at pc=0x00007fb5babe31f8, pid=4978, tid=140418842154752
  #
  # JRE version: 7.0_147-b147
  # Java VM: OpenJDK 64-Bit Server VM (21.0-b17 mixed mode linux-amd64 compressed oops)
  # Derivative: IcedTea7 2.0
  # Distribution: Ubuntu 11.10, package 7~b147-2.0-0ubuntu0.11.10.1
  # Problematic frame:
  # C  [liblcms2.so.2+0x121f8]  cmsSaveProfileToIOhandler+0x38
  #
  # Core dump written. Default location: /home/joshua/core or core.4978
  #
  # An error report file with more information is saved as:
  # /home/joshua/hs_err_pid4978.log
  #
  # If you would like to submit a bug report, please include
  # instructions on how to reproduce the bug and visit:
  #   https://bugs.launchpad.net/ubuntu/+source/openjdk-7/
  #
  Dibatalkan (core didump)

  ~~~ PS
  When I tried to compile BugIIO.java on openjdk-6 and run it on openjdk-6, the program finishes normally (no crash).

  To clarify:
  1. This bug affect OpenJDK 7 (7~b147-2.0-0ubuntu0.11.10.1) (tested on oneiric).
  2. This bug does *not* affect OpenJDK 6 (6b23~pre11-0ubuntu1.11.10) (tested on oneiric).

To manage notifications about this bug go to:
https://bugs.launchpad.net/openjdk/+bug/913434/+subscriptions


References