RFR: 8336384: AbstractQueuedSynchronizer.acquire should cancel acquire when failing due to a LinkageError or other errors [v2]
David Holmes
dholmes at openjdk.org
Tue Aug 13 22:06:53 UTC 2024
On Tue, 13 Aug 2024 08:02:04 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> > It has been a while since I knew this code reasonably well so perhaps I have just forgotten this difference between AQS and built-in monitors, but it seems that a Condition.await can return by throwing an exception without re-acquiring the associated synchronizer. Or is that handled at a higher-level?
>
> The semantics are the same as monitor wait/notify so Condition.await must guarantee to hold the lock when it returns. If ConditionNode.block were to throw something like StackOverflowError then there would be an issue (it's a different park to the one changed in this PR but I think you do have a good point).
AFAICS `await` would call the acquire method that was changed here. I know we have issues with OOME and SOE, but these changes admit more general exception possibilities that would seem to undermine the required guarantee. But perhaps a different `acquire` is involved in the `await` case?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20548#issuecomment-2287218877
More information about the core-libs-dev
mailing list