[jdk8u-dev] RFR: 8235211: serviceability/attach/RemovingUnixDomainSocketTest.java fails with AttachNotSupportedException: Unable to open socket file [v3]
Xin Liu
xliu at openjdk.java.net
Wed Apr 6 00:04:20 UTC 2022
> Hi,
>
> Could you review this backport of 8235211? This is a follow up of JDK-8225690.
>
>
> This patch can't be applied to jdk8u cleanly. We replace os::naked_yield with os::yield(), which is available in jdk8u and have same implementations on Linux/BSD/AIX. Except for that, all other changes are just path adjustment.
>
> There's a deadlock in the original backport. Both Signal dispatcher(refer to S for short) and AttachListener(A) are Java Threads. Therefore, they are subject to safepoint synchronization.
>
> A sets `_state` to AL_INITIALIZED and then get blocked at a safepoint(maybe AttachListener::dequeue).
> If the socket file is deleted and JVM receive SIGQUIT the, S realizes that the socket file has gone in `check_socket_file` and start to reinitialize it. It falls into this loop and prevent itself from reaching the safepoint.
>
> while (AttachListener::transit_state(AL_INITIALIZING,
> AL_NOT_INITIALIZED) != AL_NOT_INITIALIZED) {
> os::naked_yield();
> }
>
>
> If A waked up and realized that the socket has gone, it would set `_state` to AL_NOT_INITIALIZED. Current code is adeadlock. A can’t wake up because S hasn’t reached the safepoint yet. S can’t reach the safepoint because A hasn’t set _state to AL_NOT_INITIALIZED. This patch avoids the deadlock by trapping into blocked state before the loop.
Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
fix typo when we manually edited the two test files.
Currently, RemovingUnixDomainSocketTest.java isn't running because @test
is taken away when we backport JDK-8225690. we try to keep the patch
intact in case we enable it in the future.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk8u-dev/pull/32/files
- new: https://git.openjdk.java.net/jdk8u-dev/pull/32/files/c9df0828..6f86e099
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk8u-dev&pr=32&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk8u-dev&pr=32&range=01-02
Stats: 3 lines in 2 files changed: 3 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jdk8u-dev/pull/32.diff
Fetch: git fetch https://git.openjdk.java.net/jdk8u-dev pull/32/head:pull/32
PR: https://git.openjdk.java.net/jdk8u-dev/pull/32
More information about the jdk8u-dev
mailing list