[jdk8u-dev] RFR: 8235211: serviceability/attach/RemovingUnixDomainSocketTest.java fails with AttachNotSupportedException: Unable to open socket file [v3]

Paul Hohensee phh at openjdk.java.net
Wed Apr 6 15:36:48 UTC 2022


On Wed, 6 Apr 2022 00:04:20 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> 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.

Lgtm.

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

Marked as reviewed by phh (Reviewer).

PR: https://git.openjdk.java.net/jdk8u-dev/pull/32


More information about the jdk8u-dev mailing list