RFR: 8336384: AbstractQueuedSynchronizer.acquire should cancel acquire when failing due to a LinkageError or other errors [v2]

Alan Bateman alanb at openjdk.org
Wed Aug 14 08:37:00 UTC 2024


On Wed, 14 Aug 2024 07:33:19 GMT, David Holmes <dholmes at openjdk.org> wrote:

> When we have `Catch (Error | RuntimeException ex)` exactly what RuntimeExceptions are we trying to account for - because they should not happen and may break the synchronizer if they do.

Right now, the catch is just defending against LockSupport.park or parkNanos throwing. A timed-park on a virtual thread requires queueing a timer task and first use can involve class loading, initialisation and running more code that is obvious. We are trying to harden this as much as this as possible to never throw OOME. SOE is a lost cause. REE is possible right now and we have to do more to prevent that. Instrumentation brings a truck load of possible issues as some wild agent could instrument core classes and cause all manner of exceptions and issues. All we are doing here is just cancelling the acquire when throwing. It's just too surprising, and hard to diagnose, to throw and leaving a node queued.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20548#issuecomment-2288167767


More information about the core-libs-dev mailing list