Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use ReentrantLock for loading Extension Classes #14056

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

He-Pin
Copy link
Member

@He-Pin He-Pin commented Apr 9, 2024

What is the purpose of the change

It blocked the carrier, I wanted to do it in no blocking way, but that will require more changes.

Thread[#537,ForkJoinPool-1-worker-1,5,CarrierThreads]
    java.base/java.lang.VirtualThread$VThreadContinuation.onPinned(VirtualThread.java:183)
    java.base/jdk.internal.vm.Continuation.onPinned0(Continuation.java:393)
    java.base/java.lang.VirtualThread.park(VirtualThread.java:582)
    java.base/java.lang.System$2.parkVirtualThread(System.java:2643)
    java.base/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:54)
    java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:219)
    java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:754)
    java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1099)
    java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:230)
    org.apache.dubbo.common.utils.ClassLoaderResourceLoader.loadResources(ClassLoaderResourceLoader.java:58)
    org.apache.dubbo.common.extension.ExtensionLoader.loadDirectoryInternal(ExtensionLoader.java:1051)
    org.apache.dubbo.common.extension.ExtensionLoader.loadDirectory(ExtensionLoader.java:974)
    org.apache.dubbo.common.extension.ExtensionLoader.loadExtensionClasses(ExtensionLoader.java:962)
    org.apache.dubbo.common.extension.ExtensionLoader.getExtensionClasses(ExtensionLoader.java:939) <== monitors:1
    org.apache.dubbo.common.extension.ExtensionLoader.getSupportedExtensions(ExtensionLoader.java:601)
    org.apache.dubbo.common.extension.ExtensionLoader.getSupportedExtensionInstances(ExtensionLoader.java:608)
    com.taobao.hsf.threadpool.ThreadCleanUpUtil.<clinit>(ThreadCleanUpUtil.java:15)
    com.taobao.hsf.message.HSFServerHandler.beforeThreadExecuteCleanUp(HSFServerHandler.java:279)
    com.taobao.hsf.message.HSFServerHandler.access$000(HSFServerHandler.java:42)
    com.taobao.hsf.message.HSFServerHandler$RequestHandler.run(HSFServerHandler.java:122)
    com.taobao.wireless.amp.log.util.LogAwareEagleAsyncRunnable.run(LogAwareEagleAsyncRunnable.java:33)
    java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    java.base/java.lang.VirtualThread.run(VirtualThread.java:309)

Brief changelog

Make use of ReentrantLock to load extension classes.

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@AlbumenJ
Copy link
Member

Seems that JDK 23 EA has resolve the pining.

https://mail.openjdk.org/pipermail/loom-dev/2024-February/006433.html

@He-Pin
Copy link
Member Author

He-Pin commented Apr 10, 2024

@AlbumenJ At $Work we can't use non-LTS version Java, so I would like to see this get merged.

Copy link

sonarcloud bot commented Apr 10, 2024

@AlbumenJ AlbumenJ changed the base branch from 3.2 to 3.3 April 13, 2024 05:05
@AlbumenJ AlbumenJ merged commit 7cf5fe4 into apache:3.3 Apr 13, 2024
19 checks passed
@He-Pin He-Pin deleted the loadlock branch April 24, 2024 02:55
@He-Pin
Copy link
Member Author

He-Pin commented Apr 24, 2024

@AlbumenJ Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants