Attached is a simple wrapper that can be used to replace the default
proxy selector, to eliminate the random crashes.

How to use: simply replace the default proxy selector as soon as
possible in your application code:

    ProxySelector defaultProxySelector = ProxySelector.getDefault();
    if (defaultProxySelector!=null)
        ProxySelector.setDefault(new 
ProxySelectorWrapper(defaultProxySelector));

Details: making the select() method synchronized  eliminates the
possibility to concurrently access the MT-unsafe 'gconf_client' which is
used in the native method
sun.net.spi.DefaultProxySelector.getSystemProxy() (which in turn is
called by DefaultProxySelector.select() when property
java.net.useSystemProxies is set to true).

See:
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7188755
- http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-August/003911.html
- openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
- openjdk/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java

** Attachment added: "ProxySelectorWrapper.java"
   
https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/885195/+attachment/3439569/+files/ProxySelectorWrapper.java

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/885195

Title:
  Multithreaded proxy detection crashes the JVM

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

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

Reply via email to