Note that there are some explanatory texts on larger screens.

plurals
  1. POJava BufferedImage.createGraphics thread safe?
    primarykey
    data
    text
    <p>I am running a web server that retrieves images and does some manipulation on them. Everything works fine in unit tests, but today the web server became unresponsive, and upon doing a thread dump I see a lot of blocked threads with the following stack trace:</p> <pre><code>sun.java2d.SunGraphicsEnvironment.createGraphics(java.awt.image.BufferedImage) @bci=19, li ne=181 (Compiled frame) - sun.java2d.HeadlessGraphicsEnvironment.createGraphics(java.awt.image.BufferedImage) @bci=5, line=89 (Compiled frame) - java.awt.image.BufferedImage.createGraphics() @bci=6, line=1154 (Compiled frame) - (my package).getScaledInstance(java.awt.image.BufferedImage, int, int, java.lang.Object, boolean) @bci=113, line=120 (Compiled frame) </code></pre> <p>The line of (my) code that it gets stuck on is:</p> <pre><code> BufferedImage tmp = new BufferedImage(w, h, type); Graphics2D g2 = tmp.createGraphics(); </code></pre> <p>Is createGraphics thread-safe? I cannot find any documentation in the official javadocs stating that it isn't, but it sure looks that way(and considering that it's based on AWT, it wouldn't surprise if it wasn't). Is there anything else that could cause the thread to block like this?</p> <p>EDIT: should add that I am running on an Amazon EC2 Linux ami(the default one), running the latest version of java, </p> <pre><code>java -version java version "1.7.0_11" Java(TM) SE Runtime Environment (build 1.7.0_11-b21) Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload