From 826fe0ff30c5a95b08bc6344b1487aa62845c077 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 6 Jun 2026 13:01:19 +0200 Subject: [PATCH] tests: attempt to fix disconnect-user race that caused 300 s timeouts After the occtl disconnect, poll 'occtl show user test' until the session is gone before attempting the reconnect. This guarantees that session_close() has already returned and main's event loop is free to process the reconnect worker's AUTH_COOKIE_REQ. Addresses intermittent failures observed in the Fedora, CentOS9, and CentOS10 CI jobs. Signed-off-by: Nikos Mavrogiannopoulos --- tests/disconnect-user | 8 ++++++++ tests/disconnect-user2 | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/disconnect-user b/tests/disconnect-user index 4056a508..e85117f8 100755 --- a/tests/disconnect-user +++ b/tests/disconnect-user @@ -96,6 +96,14 @@ if test $? != 0;then exit 1 fi +# Wait for main + sec-mod to finish session cleanup before reconnecting; +# without this, session_close() blocks main's event loop and the reconnect +# worker's AUTH_COOKIE_REQ goes unread, causing a deadlock. +for i in $(seq 1 10); do + ${OCCTL} -s ${OCCTL_SOCKET} show user test >/dev/null 2>&1 || break + sleep 1 +done + echo " * Re-connecting to obtain cookie after disconnect... " ( ${CMDNS1} ${OPENCONNECT} -q ${ADDRESS}:${PORT} -u test --servercert=pin-sha256:xp3scfzy3rOQsv9NcOve/8YVVv+pHr4qNCXEXrNl5s8= -s ${srcdir}/scripts/vpnc-script -C "${COOKIE}" --pid-file=${CLIPID2} -b ) if test $? = 0;then diff --git a/tests/disconnect-user2 b/tests/disconnect-user2 index d68788d3..91ae7282 100755 --- a/tests/disconnect-user2 +++ b/tests/disconnect-user2 @@ -91,6 +91,14 @@ if test $? != 0;then exit 1 fi +# Wait for main + sec-mod to finish session cleanup before reconnecting; +# without this, session_close() blocks main's event loop and the reconnect +# worker's AUTH_COOKIE_REQ goes unread, causing a deadlock. +for i in $(seq 1 10); do + ${OCCTL} -s ${OCCTL_SOCKET} show user test >/dev/null 2>&1 || break + sleep 1 +done + echo " * Re-connecting to obtain cookie after disconnect... " ( ${CMDNS1} ${OPENCONNECT} -q ${ADDRESS}:${PORT} -u test --servercert=pin-sha256:xp3scfzy3rOQsv9NcOve/8YVVv+pHr4qNCXEXrNl5s8= -s ${srcdir}/scripts/vpnc-script -C "${COOKIE}" --pid-file=${CLIPID} -b ) if test $? = 0;then