I've found this issue happens intermitently on my setup:
Ubuntu 13.04 64-bit
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

I get an intermitent crash when decoding JPEGs, decoding in several
threads.

Thread pool is created thus:
        ExecutorService threadpool = 
Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()+1); 

Image decode tasks added this:
        ImageScaler scaler = new ImageScaler(size);
        threadpool.submit(scaler);

ImageScaler class is:
        private class ImageScaler extends SwingWorker<ImageIcon, String> {
                private int size;

                public ImageScaler(int size) {
                        this.size = size;
                }

                @Override
                public ImageIcon doInBackground() {
                        LOGGER.log(Level.FINE,
                                        "Loading image: "+url);
                        
                        ImageReader ir;
                        
                        //create a new instance of imageReader
                        synchronized(sync){
                                Iterator<ImageReader> it = 
ImageIO.getImageReadersByMIMEType("image/jpeg");
                                ir = it.next();
                                if (ir == null) {
                                        LOGGER.log(Level.SEVERE,
                                                        "No image reader found 
for JPEGs");
                                        System.exit(1);
                                }
                                ImageReaderSpi spi = 
ir.getOriginatingProvider();
                                try {
                                        ir = spi.createReaderInstance();
                                } catch (Exception e) {
                                        LOGGER.log(Level.SEVERE,
                                                        "Could not create new 
JPEG reader instance", e);
                                        return null;
                                }
                        }
                        
                        //Load the image from the URL (could be local or HTTP)
                        BufferedImage image;
                        try {

[...]
                                File cacheDir = new File (strCacheDir);
                                cacheDir.mkdirs();
                                URL u = new URL(url);
                                FileCacheImageInputStream fcis = new 
FileCacheImageInputStream(
                                        u.openStream(), cacheDir);
                                ir.setInput(fcis);
                                image = ir.read(0);
                                fcis.close();
                        } catch (Exception e) {
                                LOGGER.log(Level.WARNING,
                                                "Could not read image "+url, e);
                                return null;
                        } catch (OutOfMemoryError e) {
                                LOGGER.log(Level.WARNING,
                                                "Out of memory reading image: 
"+url, e);
                                return null;
                        } finally {
                                ir.dispose();
                        }
                                                
                        return new ImageIcon(resizeImage(image, size));
                 }

                @Override
                protected  void done() {
                        if (isCancelled())
                                return;
                        ImageIcon icon = null;
                        try {
                                icon = get();
                        } catch (Exception ignore) {}
                        if (icon == null) {
                                LOGGER.log(Level.WARNING,
                                                "Scaled image is null: "+url);
                                return;
                        }
                        rendered = icon;
                        renderedSize = size;
                        mPcs.firePropertyChange(PNAME_RENDEREDICON, 0, 1);
                }

        }

The crash actually occurs in ICC_Profile code. I get intermitent colour
issues with decoded JPEGs where the image is totally mid-green except
for areas that are dark which tend to black. Is there an issue in the
colour code for multi-threaded decode? I've done my best to create an
image reader in a thread-safe way.

I've attached the crash log file.

** Attachment added: "Crash log file"
   
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/913434/+attachment/3840753/+files/hs_err_pid8616.log

-- 
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-7” package in Ubuntu:
  Confirmed

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/ubuntu/+source/openjdk-7/+bug/913434/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~openjdk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openjdk
More help   : https://help.launchpad.net/ListHelp

Reply via email to