JDK-7188755 : Crash due to missing synchronization on gconf_client in DefaultProxySelector.c
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 6u10,6u20,7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux,linux_ubuntu
  • CPU: generic,unknown,x86
  • Submitted: 2012-08-02
  • Updated: 2015-08-06
  • Resolved: 2012-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b55Fixed
Related Reports
Duplicate :  
Description
Using the system property 'java.net.useSystemProxies', JDK 7 crashes on 
OpenBSD 5.2.

$ /usr/local/jre-1.7.0/bin/java -version
openjdk version "1.7.0_03"
OpenJDK Runtime Environment (build 1.7.0_03-b04)
OpenJDK Server VM (build 22.1-b02, mixed mode)

$ /usr/local/jre-1.7.0/bin/java -cp . Crash
2538: assertion failed "allocator->lock_loc == NULL" file 
"/usr/ports/pobj/dbus-1.6.2/dbus-1.6.2/dbus/dbus-dataslot.c" line 79 
function _dbus_data_slot_allocator_alloc
2538: assertion failed "allocator->lock_loc == NULL" file 
"/usr/ports/pobj/dbus-1.6.2/dbus-1.6.2/dbus/dbus-dataslot.c" line 79 
function _dbus_data_slot_allocator_alloc
2538: assertion failed "allocator->lock_loc == NULL" file 
"/usr/ports/pobj/dbus-1.6.2/dbus-1.6.2/dbus/dbus-dataslot.c" line 79 
function _dbus_data_slot_allocator_alloc
2538: assertion failed "allocator->lock_loc == NULL" file 
"/usr/ports/pobj/dbus-1.6.2/dbus-1.6.2/dbus/dbus-dataslot.c" line 79 
function _dbus_data_slot_allocator_alloc
   D-Bus not compiled with backtrace support so unable to print a backtrace
   D-Bus not compiled with backtrace support so unable to print a backtrace

$ /usr/local/jre-1.7.0/bin/java -cp . Crash
27421: assertion failed "!(connection)->have_connection_lock" file 
"/usr/ports/pobj/dbus-1.6.2/dbus-1.6.2/dbus/dbus-connection.c" line 1133 
function _dbus_connection_acquire_io_path
   D-Bus not compiled with backtrace support so unable to print a backtrace
Abort trap (core dumped)

Looking at 
'openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c', 
there is a 'static void* gconf_client' which is initialized by calling 
'gconf_client_get_default' from 'libgconf-2'. Uses of that client are 
not protected against concurrent accesses by multiple threads although 
that gconf client is not thread-safe. Trying to add some protection 
myself resulted in the attached patch. Rebuilding JDK 1.7 with this 
patch applied, the 'gconf'/'dbus' related crashes no longer happen.

see discussion on jdk7u-dev, and subsequently on net-dev mailing lists:

http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-August/003911.html
http://mail.openjdk.java.net/pipermail/net-dev/2012-August/004610.html

Comments
EVALUATION JDK8 Changeset: e7d125f2575b Author: chegar Date: 2012-08-12 22:56 +0100 URL: http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/e7d125f2575b 7188755: Crash due to missing synchronization on gconf_client in DefaultProxySelector.c Reviewed-by: chegar Contributed-by: Christian Schulte <###@###.###> ! src/share/classes/sun/net/spi/DefaultProxySelector.java + test/java/net/ProxySelector/MultiThreadedSystemProxies.java
06-08-2015

MultiThreadedSystemProxies passes.
02-08-2013