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 Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/913434

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

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

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to