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

Fix potential NPE from VirtualThreadPool #12198

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

lachlan-roberts
Copy link
Contributor

Failure from testThreadPool – org.eclipse.jetty.util.thread.QueuedThreadPoolTest
https://jenkins.webtide.net/blue/organizations/jenkins/jetty.project/detail/PR-12181/7/tests

Error
Cannot invoke "java.util.concurrent.Semaphore.release()" because "this._semaphore" is null
Stacktrace
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Semaphore.release()" because "this._semaphore" is null
	at org.eclipse.jetty.util@12.1.0-SNAPSHOT/org.eclipse.jetty.util.thread.VirtualThreadPool.lambda$execute$0(VirtualThreadPool.java:279)
	at org.eclipse.jetty.util@12.1.0-SNAPSHOT/org.eclipse.jetty.util.thread.TrackingExecutor.lambda$execute$0(TrackingExecutor.java:47)
	at java.base/java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(ThreadPerTaskExecutor.java:314)
	at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)
Standard Error
Running org.eclipse.jetty.util.thread.ThreadFactoryTest.testThreadFactory()

Looks like a race condition where doStop() is called while an execute has been called. This PR stops semaphore from being null between the if (semaphore != null) check and the semaphore.acquire().

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@joakime
Copy link
Contributor

joakime commented Aug 26, 2024

Flaky test.

testExpect100ContinueWithContentRespond413RequestEntityTooLarge(Transport)[3] H2C – org.eclipse.jetty.ee10.test.client.transport.HttpClientContinueTest

Going to merge anyway.

@joakime joakime merged commit 394bc13 into jetty-12.0.x Aug 26, 2024
7 of 10 checks passed
@joakime joakime deleted the jetty-12.0.x-VirtualThreadPoolSemaphore branch August 26, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Flaky test - org.eclipse.jetty.util.thread.ThreadFactoryTest.testThreadFactory()
3 participants