Integrated: 8211851: (ch) java/nio/channels/AsynchronousSocketChannel/StressLoopback.java times out (aix)
Joachim Kern
jkern at openjdk.org
Tue Jan 7 13:56:52 UTC 2025
On Mon, 9 Dec 2024 09:53:26 GMT, Joachim Kern <jkern at openjdk.org> wrote:
> Test /jdk/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java times out on aix.
>
> The problem is that in queueControlEvent() for every event added to the controlQueue one byte is written to the ctlSP pipe to wakeup the poll thread running in poll(). The poll() function of the poll thread is just taking this one byte from the pipe but handling then all events in the controlQueue. Afterwards the controlQueue is empty, but the pipe is only 1 byte shorter. This is an asymmetric and therefore false behavior. So I changed the drain1() to a drain() meaning drain_all() which heals this asymmetry.
> The problem leading to the timeout was, that more and more (StressLoopback: nomen est omen) wakeup bytes were written to the pipe, but the poll thread runs in much lower frequency. So, at some time the pipe was full on OS side, resulting in a blocking Pollset.interrupt(ctlSp[1]) in queueControlEvent(). Unfortunately, at this moment the controlQueue sync object is in locked state, resulting that the poll thread cannot acquire this lock to read from the pipe. No reading from the pipe means the pipe remains full and the dead lock is there.
> Additionally, I found a flaw in the emulator of the ‘one shot’ semantic. Here the original implantation was not save against deleting a just registered fd before the next poll. To fix this I separated the emulation of the ‘one shot’ from the rest of the poll() actions. Now, the ‘one shot’ emulation is encapsulated in the controlLock.lock()block, which guards the poll itself.
This pull request has now been integrated.
Changeset: 8b22517c
Author: Joachim Kern <jkern at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/8b22517cb0b24c4134a2dbf22591f6f84d7d866c
Stats: 55 lines in 2 files changed: 21 ins; 16 del; 18 mod
8211851: (ch) java/nio/channels/AsynchronousSocketChannel/StressLoopback.java times out (aix)
Reviewed-by: mdoerr, varadam
-------------
PR: https://git.openjdk.org/jdk/pull/22633
More information about the nio-dev
mailing list