Bug 2300 - reexec.sh and login-timeout.sh fail due to a race condition
Summary: reexec.sh and login-timeout.sh fail due to a race condition
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Regression tests (show other bugs)
Version: 6.7p1
Hardware: Other Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-25 09:08 AEDT by Petr Lautrbach
Modified: 2021-04-23 15:03 AEST (History)
1 user (show)

See Also:


Attachments
fix race condition between kill sshd and start_sshd (1.97 KB, patch)
2014-10-25 09:08 AEDT, Petr Lautrbach
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Lautrbach 2014-10-25 09:08:42 AEDT
Created attachment 2499 [details]
fix race condition between kill sshd and start_sshd

run test reexec.sh ...
test config passing
FATAL: no sshd running on port 4242
Makefile:168: recipe for target 't-exec' failed
make[1]: *** [t-exec] Error 1
make[1]: Leaving directory '/home/plautrba/devel/src/bachradsusi.github/openssh-portable.git/regress'
Makefile:483: recipe for target 'tests' failed
make: *** [tests] Error 2

The problem is in the race between

$SUDO kill `$SUDO cat $PIDFILE`

and following

start_sshd

While sshd is still runnning and closing opened socket after it got a signal, the test tries to run a new sshd instance which cannot bind to not-yet-released socket. The attached patch tries to fix it.
Comment 1 Damien Miller 2020-01-25 23:56:42 AEDT
the tests have had a stop_sshd function that waits for sshd to actually exit since 2016.
Comment 2 Damien Miller 2021-04-23 15:03:37 AEST
closing resolved bugs as of 8.6p1 release