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 #12192

Closed

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>
@sbordet
Copy link
Contributor

sbordet commented Aug 23, 2024

@lachlan-roberts this PR should be for Jetty 12.0.x, can you please re-do it for that branch?

@lachlan-roberts
Copy link
Contributor Author

replaced by #12198

@lachlan-roberts lachlan-roberts deleted the jetty-12.1.x-VirtualThreadPoolSemaphore branch August 26, 2024 02:39
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.

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