[
https://issues.apache.org/jira/browse/FELIX-5942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16625982#comment-16625982
]
ASF GitHub Bot commented on FELIX-5942:
---------------------------------------
GitHub user adessaigne opened a pull request:
https://github.com/apache/felix/pull/156
FELIX-5942 - Replace wait/notify by lock/conditions in Felix to avoid freeze
Fix proposal for
[FELIX-5942](https://issues.apache.org/jira/browse/FELIX-5942).
Instead of a single `Object` with calls to `wait` and `notifyAll` we're
using a `Lock` with 2 `Condition` objects :
* one when the waiting conditions on global lock acquisition have changed
* one when the waiting conditions on bundle lock acquisition have changed
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/adessaigne/felix FELIX-5942
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/felix/pull/156.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #156
----
commit d906ec37291bbc7d9fd4bd3211aaae0b4f9eac00
Author: Antoine DESSAIGNE <antoine.dessaigne@...>
Date: 2018-09-24T15:22:12Z
FELIX-5942 - Replace wait/notify by lock/conditions in Felix to avoid freeze
----
> Felix Framework freezes when resolving classes in parallel with Java 10
> -----------------------------------------------------------------------
>
> Key: FELIX-5942
> URL: https://issues.apache.org/jira/browse/FELIX-5942
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Affects Versions: framework-6.0.1
> Reporter: Antoine DESSAIGNE
> Assignee: Karl Pauls
> Priority: Major
> Attachments: ConcurrentClassLoaderTest.java
>
>
> Hello.
> When resolving a class in parallel in Java 10, you end up with a freeze.
> You end up with threads beeing blocked
> {noformat}
> "Thread-99" #121 prio=5 os_prio=0 tid=0x000001bdaf679000 nid=0x69d4 in
> Object.wait() [0x000000296d0fe000]
> java.lang.Thread.State: BLOCKED (on object monitor)
> at java.lang.Object.wait([email protected]/Native Method)
> - waiting on <0x00000006c931dd20> (a [Ljava.lang.Object;)
> at java.lang.Object.wait([email protected]/Object.java:328)
> at org.apache.felix.framework.Felix.acquireGlobalLock(Felix.java:4301)
> - waiting to re-lock in wait() <0x00000006c931dd20> (a
> [Ljava.lang.Object;)
> at
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:413)
> at
> org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3318)
> at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1618)
> at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
> at
> org.apache.felix.framework.ConcurrentClassLoaderTest$1.run(ConcurrentClassLoaderTest.java:69){noformat}
> You'll find attached a test reproducing the issue :
> [^ConcurrentClassLoaderTest.java]
> Here's what you need to freeze felix :
> * Lots of threads trying to acquire the global lock
> ** here we're resolving a class from a bundle with dynamic import packages
> * An Oracle JDK 10 or OpenJDK 11
> ** it's working fine with Oracle JDK 8
>
> Replacing the {{m_bundleLock}} by a fair {{ReentrantLock}} with a
> {{Condition}} makes it work with 10 parallel threads but still fails with 100
> threads.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)