Skip to content

Commit

Permalink
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
@@ -827,7 +827,14 @@ private static RubyModule getProxyClassOrNull(final Ruby runtime, final String c
final boolean initJavaClass) {
final Class<?> clazz;
try { // loadJavaClass here to handle things like LinkageError through
clazz = runtime.getJavaSupport().loadJavaClass(className);
synchronized (Java.class) {
// a circular load might potentially dead-lock when loading concurrently
// this path is reached from JavaPackage#relativeJavaClassOrPackage ...
// another part preventing concurrent proxy initialization dead-locks is :
// JavaSupportImpl's proxyClassCache = ClassValue.newInstance( ... )
// ... having synchronized RubyModule computeValue(Class<?>)
clazz = runtime.getJavaSupport().loadJavaClass(className);
}
}
catch (ExceptionInInitializerError ex) {
throw runtime.newNameError("cannot initialize Java class " + className + ' ' + '(' + ex + ')', className, ex, false);
2 changes: 0 additions & 2 deletions test/jruby/test_higher_javasupport.rb
Original file line number Diff line number Diff line change
@@ -1463,8 +1463,6 @@ def test_concurrent_proxy_class_initialization_invalid_method_dispatch

# reproducing https://github.com/jruby/jruby/issues/1621
def test_concurrent_proxy_class_initialization_dead_lock
pend "Excluded for the moment to uncloud what else is keeping ci red (kares looking into this one)"

timeout = 0.5; threads_to_kill = []
begin
threads = %w{ A B C D E F G H }.map do |sym|

0 comments on commit f1280b1

Please sign in to comment.