-
Notifications
You must be signed in to change notification settings - Fork 853
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
Updated AttributeMap to not close ExecutorService on Java 21 #4649
Conversation
…osing it as happens as of Java 21
Thanks @michaeldimchuk, change looks good to me. Let me trigger our tests |
Not totally sure why all the jobs failed on the |
You're fine, this is expected behavior. Our CI setup doesn't allow auto builds for forked PRs (we have to manually trigger them). |
Integ test failure because of Maven connection reset. Retrying |
LGTM, thanks! |
Kudos, SonarCloud Quality Gate passed! |
@all-contributors please add @michaeldimchuk for code |
I've put up a pull request to add @michaeldimchuk! 🎉 |
As of Java 21, ExecutorService extends
AutoCloseable
, soAttributeMap#close
needs to be updated to avoid closing the executor and potentially cause a deadlock.Motivation and Context
Starting with Java 21,
ExecutorService
extends theAutoCloseable
interface, which causesAttributeMap#close
to pick up executor instances and try and close them, which can create deadlocks and cause the application to hang.Issue: #4395
Modifications
Updated the
AttributeMap#close
method to first check if the attribute is an ExecutorService, and shut it down if so, otherwise check if the object is closeable and close it if needed.Testing
AttributeMap#close
on a thread owned by an ExecutorService theAttributeMap
instance manages does not result in a deadlockTypes of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License