-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
7
-
windows_7
FULL PRODUCT VERSION :
Version 7 Update 7 (build 1.7.0_07-b11)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
The ImageIcon class loads image from URL now becomes massively slow. The code to reproduce is very simple:
new ImageIcon(new URL( " image url " ));
My investigation suggests it now tries to retrieve a pack.gz version of the image, before it tries to retrieve the original file from remote URL.
This behaviour introduces a massive performance hits for my Applet application. In my server, the pack.gz file doesn't exist, and the server sends back a 302 redirect response. So the applet follows the redirect and grabbed the redirected page. It becomes massively slow now since our client upgraded their Java version.
This bug seems to be only introduced since 1.7.0_07.
The Java file caching has to be enabled, and there must be an existing cached file to be able to reproduce this bug.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Make sure Java cache is enabled.
Create a basic Applet. In the init function, create an image icon using a URL source.
For example:
# get the icon from URL
url = new URL( " http://website/icon.png " );
ImageIcon icon = new ImageIcon(url);
JLabel copyLabel = new JLabel(icon);
# add the icon to appley and display it
add(copyLabel);
Start the applet, the image icon will display fine, and also cached in Java.
Close the browser, and start the applet again.
You will notice the applet takes much longer time to load than first time.
Following message is displayed in console:
CacheEntry[http://website.com/icon.png]: updateAvailable=true,lastModified=Fri Nov 25 09:20:02 EST 2005,length=806
Analise the web traffic using Wireshark. It suggests that the Applet tries to retrieve http://website.com/icon.png.pack.gz first which wastes a lot of time.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Image will be loaded fine, no performance hits compared to initial load.
No warning messages in console.
it shouldn't try to retrieve the pack.gz file.
ACTUAL -
It tries to retrieve the pack.gz version of image file, and becomes very slow
ERROR MESSAGES/STACK TRACES THAT OCCUR :
CacheEntry[http://website.com/icon.png]: updateAvailable=true,lastModified=Fri Nov 25 09:20:02 EST 2005,length=806
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class JLabelWithIconExample extends JApplet{
public void init(){
/*
* Create an icon from an image using
* ImageIcon(String imagePath, String description)
* constructor.
*/
URL url = null;
try {
url = new URL( " http://testwebsite/icon.png " );
} catch (java.net.MalformedURLException e) {
System.err.println( " Couldn't create image: badly specified URL " );
}
ImageIcon icon = new ImageIcon(url);
/*
* To create a JLabel with image icon use,
* JLabel(Icon icon)
* constructor of JLabel class.
*/
JLabel copyLabel = new JLabel(icon);
/*
* Add label to an applet
*/
add(copyLabel);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Turn off Apache rewrite rule or any similar rule, so whenever pack.gz file is requested, it returns 404 status code.
This appears to make the Applet loads image faster. Because it won't follow redirect to new URLs.
Version 7 Update 7 (build 1.7.0_07-b11)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]
A DESCRIPTION OF THE PROBLEM :
The ImageIcon class loads image from URL now becomes massively slow. The code to reproduce is very simple:
new ImageIcon(new URL( " image url " ));
My investigation suggests it now tries to retrieve a pack.gz version of the image, before it tries to retrieve the original file from remote URL.
This behaviour introduces a massive performance hits for my Applet application. In my server, the pack.gz file doesn't exist, and the server sends back a 302 redirect response. So the applet follows the redirect and grabbed the redirected page. It becomes massively slow now since our client upgraded their Java version.
This bug seems to be only introduced since 1.7.0_07.
The Java file caching has to be enabled, and there must be an existing cached file to be able to reproduce this bug.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Make sure Java cache is enabled.
Create a basic Applet. In the init function, create an image icon using a URL source.
For example:
# get the icon from URL
url = new URL( " http://website/icon.png " );
ImageIcon icon = new ImageIcon(url);
JLabel copyLabel = new JLabel(icon);
# add the icon to appley and display it
add(copyLabel);
Start the applet, the image icon will display fine, and also cached in Java.
Close the browser, and start the applet again.
You will notice the applet takes much longer time to load than first time.
Following message is displayed in console:
CacheEntry[http://website.com/icon.png]: updateAvailable=true,lastModified=Fri Nov 25 09:20:02 EST 2005,length=806
Analise the web traffic using Wireshark. It suggests that the Applet tries to retrieve http://website.com/icon.png.pack.gz first which wastes a lot of time.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Image will be loaded fine, no performance hits compared to initial load.
No warning messages in console.
it shouldn't try to retrieve the pack.gz file.
ACTUAL -
It tries to retrieve the pack.gz version of image file, and becomes very slow
ERROR MESSAGES/STACK TRACES THAT OCCUR :
CacheEntry[http://website.com/icon.png]: updateAvailable=true,lastModified=Fri Nov 25 09:20:02 EST 2005,length=806
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class JLabelWithIconExample extends JApplet{
public void init(){
/*
* Create an icon from an image using
* ImageIcon(String imagePath, String description)
* constructor.
*/
URL url = null;
try {
url = new URL( " http://testwebsite/icon.png " );
} catch (java.net.MalformedURLException e) {
System.err.println( " Couldn't create image: badly specified URL " );
}
ImageIcon icon = new ImageIcon(url);
/*
* To create a JLabel with image icon use,
* JLabel(Icon icon)
* constructor of JLabel class.
*/
JLabel copyLabel = new JLabel(icon);
/*
* Add label to an applet
*/
add(copyLabel);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Turn off Apache rewrite rule or any similar rule, so whenever pack.gz file is requested, it returns 404 status code.
This appears to make the Applet loads image faster. Because it won't follow redirect to new URLs.