RFR: JDK-8235211: serviceability/attach/RemovingUnixDomainSocketTest.java fails with AttachNotSupportedException: Unable to open socket file
Yasumasa Suenaga
suenaga at oss.nttdata.com
Sat May 9 15:28:11 UTC 2020
Hi Alex,
It seems to be hanged in check_socket_file() because AttachListener::deque() could not return due to safepoint.
So it is good idea to use ThreadBlockInVM, but I think we can change as below to reduce overhead:
```
{
ThreadBlockInVM tbivm(JavaThread::current());
while (AttachListener::transit_state(AL_INITIALIZING,
AL_NOT_INITIALIZED) != AL_NOT_INITIALIZED) {
os::naked_yield();
}
}
```
It might consume much CPU time with long safepoint, but I think it is corner case because this issue occurs intermittently.
Thanks,
Yasumasa
On 2020/05/09 10:14, Alex Menkov wrote:
> Hi all,
>
> please review the fix for
> https://bugs.openjdk.java.net/browse/JDK-8235211
> webrev:
> http://cr.openjdk.java.net/~amenkov/jdk15/RemovingUnixDomainSocket/webrev/
>
> Test failures are caused by deadlock during attach listener restarting:
> check_socket_file function aborts socket listening and waits while attach listener state becomes AL_NOT_INITIALIZED (it happens when AttachListener::dequeue returns NULL).
> AttachListener::dequeue method is blocked in ThreadBlockInVM dtor.
> To solve it ThreadBlockInVM was added inside waiting cycle in check_socket_file.
>
> Other changes:
> - made _listener (and _shutdown for aix) volatile as they are used by 2 threads (attach listener thread and signal handler thread) without synchronization;
> - added close() for listening socket on aix (before it had only shutdown() for it);
> - additional logging and some cleanup in the test;
> - added handling of LingeredApp hang.
>
> --alex
More information about the serviceability-dev
mailing list