-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
My program tries to use com.sun.deploy.net.proxy.* classes to get a proxy from PAC file (Proxy Auto Config).
I find performance degradation when getProxyInfo() is called repeatedly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample progam, with jre\lib\deploy.jar in classpath
Passing a PAC URL
java TestProxyHandler http://somehost/somepac.pac http://java.sun.com
The PAC file "somepac.pac" could be as simple as
function FindProxyForURL(url, host)
{
return "DIRECT";
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
In the source code, the time spent in calling getProxyInfo() in WIExplorerAutoProxyHandler.java is logged.
This method is called repeatedly (like running a load test).
The expected result is the time spent in the getProxyInfo() function should be more or less the same no matter how many times the function is called.
ACTUAL -
The time spent in the getProxyInfo() function is increasing from a few milliseconds to more than a second after thousands of calls.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.URL;
import com.sun.deploy.net.proxy.BrowserProxyInfo;
import com.sun.deploy.net.proxy.ProxyHandler;
import com.sun.deploy.net.proxy.ProxyInfo;
import com.sun.deploy.net.proxy.ProxyType;
import com.sun.deploy.services.PlatformType;
import com.sun.deploy.services.ServiceManager;
public class TestProxyHandler {
private ProxyHandler proxyHandler = null;
private BrowserProxyInfo browserproxyinfo;
private static int osType;
static {
osType = (System.getProperty("os.name").indexOf("Windows") != -1) ? PlatformType.STANDALONE_TIGER_WIN32 : PlatformType.STANDALONE_TIGER_UNIX;
}
public TestProxyHandler(String pacUrl, String url) throws Exception {
if (url != null && url.trim().length() > 0) {
ServiceManager.setService(osType);
proxyHandler = ServiceManager.getService().getAutoProxyHandler();
if (proxyHandler != null) {
browserproxyinfo = new BrowserProxyInfo();
browserproxyinfo.setAutoConfigURL(pacUrl);
browserproxyinfo.setType(ProxyType.AUTO);
proxyHandler.init(browserproxyinfo);
while (true) {
long startTime = System.currentTimeMillis();
ProxyInfo[] pis = proxyHandler.getProxyInfo(new URL(url));
System.out.println(System.currentTimeMillis() - startTime);
for (ProxyInfo pi : pis) {
String httpHost = pi.getProxy();
int httpPort = pi.getPort();
System.out.println(httpHost + ":" + httpPort);
}
}
}
}
}
public static void main(String[] args) {
if (args.length != 2) {
System.out.println("usage: java TestProxyHandler [PAC url] [url]");
return;
}
try {
new TestProxyHandler(args[0], args[1]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
My program tries to use com.sun.deploy.net.proxy.* classes to get a proxy from PAC file (Proxy Auto Config).
I find performance degradation when getProxyInfo() is called repeatedly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample progam, with jre\lib\deploy.jar in classpath
Passing a PAC URL
java TestProxyHandler http://somehost/somepac.pac http://java.sun.com
The PAC file "somepac.pac" could be as simple as
function FindProxyForURL(url, host)
{
return "DIRECT";
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
In the source code, the time spent in calling getProxyInfo() in WIExplorerAutoProxyHandler.java is logged.
This method is called repeatedly (like running a load test).
The expected result is the time spent in the getProxyInfo() function should be more or less the same no matter how many times the function is called.
ACTUAL -
The time spent in the getProxyInfo() function is increasing from a few milliseconds to more than a second after thousands of calls.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.URL;
import com.sun.deploy.net.proxy.BrowserProxyInfo;
import com.sun.deploy.net.proxy.ProxyHandler;
import com.sun.deploy.net.proxy.ProxyInfo;
import com.sun.deploy.net.proxy.ProxyType;
import com.sun.deploy.services.PlatformType;
import com.sun.deploy.services.ServiceManager;
public class TestProxyHandler {
private ProxyHandler proxyHandler = null;
private BrowserProxyInfo browserproxyinfo;
private static int osType;
static {
osType = (System.getProperty("os.name").indexOf("Windows") != -1) ? PlatformType.STANDALONE_TIGER_WIN32 : PlatformType.STANDALONE_TIGER_UNIX;
}
public TestProxyHandler(String pacUrl, String url) throws Exception {
if (url != null && url.trim().length() > 0) {
ServiceManager.setService(osType);
proxyHandler = ServiceManager.getService().getAutoProxyHandler();
if (proxyHandler != null) {
browserproxyinfo = new BrowserProxyInfo();
browserproxyinfo.setAutoConfigURL(pacUrl);
browserproxyinfo.setType(ProxyType.AUTO);
proxyHandler.init(browserproxyinfo);
while (true) {
long startTime = System.currentTimeMillis();
ProxyInfo[] pis = proxyHandler.getProxyInfo(new URL(url));
System.out.println(System.currentTimeMillis() - startTime);
for (ProxyInfo pi : pis) {
String httpHost = pi.getProxy();
int httpPort = pi.getPort();
System.out.println(httpHost + ":" + httpPort);
}
}
}
}
}
public static void main(String[] args) {
if (args.length != 2) {
System.out.println("usage: java TestProxyHandler [PAC url] [url]");
return;
}
try {
new TestProxyHandler(args[0], args[1]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------