← Back to team overview

openjdk team mailing list archive

[Bug 885195] Re: Multithreaded proxy detection crashes the JVM

 

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 OpenJDK,
which is subscribed to openjdk-6 in Ubuntu.
https://bugs.launchpad.net/bugs/885195

Title:
  Multithreaded proxy detection crashes the JVM

Status in “openjdk-6” package in Ubuntu:
  Confirmed

Bug description:
  Calling ProxySelector.select on multiple threads with
  java.net.useSystemProxies can cause the VM to randomly crash or output
  dbus assertion errors. This only affects Linux and has only been
  reported by our users since Ubuntu 11.10 was released (although there
  is a similar bug in Glassfish -
  http://java.net/jira/browse/GLASSFISH-12213).

  If the application crashes then it will be in either [libdbus-1.so.3] dbus_watch_handle or [libc.so.6]  _IO_str_pbackfail. The dbus error outputted when it fails but doesn't crash the VM is:
  (process:23565): GConf-CRITICAL **: gconf_engine_get_fuller: assertion `err == NULL || *err != NULL' failed

  Adding a synchronized block to the select call solves the problem in
  our application but no calls to the Java standard library should cause
  a VM crash.

  ProblemType: Bug
  DistroRelease: Ubuntu 11.10
  Package: openjdk-6-jre-headless 6b23~pre10-0ubuntu5
  ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
  Uname: Linux 3.0.0-12-generic i686
  ApportVersion: 1.23-0ubuntu4
  Architecture: i386
  Date: Wed Nov  2 12:52:39 2011
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
  ProcEnviron:
   LANGUAGE=en_GB:en
   PATH=(custom, user)
   LANG=en_GB.UTF-8
   SHELL=/bin/bash
  SourcePackage: openjdk-6
  UpgradeStatus: Upgraded to oneiric on 2011-10-14 (19 days ago)

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


References