Skip to content

Commit

Permalink
lkp-bootstrap: workaround to avoid parallel running of test execution
Browse files Browse the repository at this point in the history
e.g. below ps shows two lkp-bootstrap processes are running on xps, due to race condition in lkp-bootstrap.pid creation and check. One is from /etc/init.d/lkp-bootstrap, the other
is from /etc/systemd/system/lkp-bootstrap.service.

BTW: the sleep 333.3 is just a random number, usually it doesn't require long sleep before lkp-bootstrap.pid is created by another process.

root       281  0.0  0.0   4300   132 ?        S    07:46   0:00 /bin/sh /etc/init.d/lkp-bootstrap
root       283  0.0  0.0   4300  1752 ?        S    07:46   0:00  \_ /bin/sh /lkp/lkp/src/bin/lkp-setup-rootfs
root       300  0.0  0.0   4244   788 ?        S    07:46   0:00      \_ tail -f /tmp/stdout
root       302  0.3  0.8  45964 32536 ?        S    07:46   0:00      \_ sed -u -r s/^(.{0,900}).*$/<5>\1/
root       303  0.0  0.0   4244   736 ?        S    07:46   0:00      \_ tail -f /tmp/stderr
root       304  0.6  0.6  39644 25560 ?        S    07:46   0:00      \_ sed -u -r s/^(.{0,900}).*$/<3>\1/
root       655  0.0  0.0   4300  1700 ?        S    07:46   0:00      \_ /bin/sh /lkp/lkp/src/bin/run-lkp
/lkp/scheduled/xps/mdadm-selftests-18-debian-x86_64-2016-08-31.cgz-0c867962dc6e65d7242b1d10592067166cd53188-20161010-17325-1jqe222-0.yaml
root       705  0.0  0.0   4304  1684 ?        S    07:46   0:00          \_ /bin/sh
/lkp/scheduled/xps/mdadm-selftests-18-debian-x86_64-2016-08-31.cgz-0c867962dc6e65d7242b1d10592067166cd53188-20161010-17325-1jqe222-0.sh run_job
root       707  0.2  0.0  12760   944 ?        S    07:46   0:00              \_ dmesg --follow --decode
root       744  0.1  0.0   5264   708 ?        S    07:46   0:00              |   \_ cat /tmp/lkp/fifo-kmsg
root       708  0.0  0.0  27492  1492 ?        S    07:46   0:00              \_ vmstat --timestamp -n 10
root       738  0.0  0.0   5264   672 ?        S    07:46   0:00              |   \_ cat /tmp/lkp/fifo-heartbeat
root       710  0.0  0.0   4300  1620 ?        S    07:46   0:00              \_ /bin/sh /lkp/lkp/src/monitors/plain/watchdog
root       865  0.0  0.0    240     4 ?        S    07:46   0:00              |   \_ /lkp/lkp/src/bin/event/wait job-finished --timeout 3600
root       797  0.0  0.0   4196   660 ?        S    07:46   0:00              \_ /usr/bin/time -v -o /tmp/lkp/mdadm-selftests.time /lkp/lkp/src/tests/mdadm-selftests
root       800  0.0  0.0   4216   676 ?        S    07:46   0:00                  \_ tee -a /tmp/lkp/result/mdadm-selftests
root       803  0.0  0.0   4300  1584 ?        S    07:46   0:00                  \_ /bin/sh /lkp/lkp/src/tests/mdadm-selftests
root       811  0.0  0.0   8484   820 ?        S    07:46   0:00                      \_ timeout 5m ./test --tests=18imsm-1d-takeover-r0_1d
root       812  0.1  0.0  20356  3212 ?        S    07:46   0:00                          \_ /bin/bash ./test --tests=18imsm-1d-takeover-r0_1d
root      1761  0.0  0.0   4212   760 ?        S    07:47   0:00                              \_ sleep 1

root       286  0.0  0.0   4300   128 ?        S    07:46   0:00 /bin/sh /etc/init.d/lkp-bootstrap
root       288  0.0  0.0   4300  1740 ?        S    07:46   0:00  \_ /bin/sh /lkp/lkp/src/bin/lkp-setup-rootfs
root       306  0.0  0.0   4244   720 ?        S    07:46   0:00      \_ tail -f /tmp/stdout
root       307  0.3  0.7  45964 31356 ?        S    07:46   0:00      \_ sed -u -r s/^(.{0,900}).*$/<5>\1/
root       308  0.0  0.0   4244   788 ?        S    07:46   0:00      \_ tail -f /tmp/stderr
root       310  0.6  0.6  39644 24960 ?        S    07:46   0:00      \_ sed -u -r s/^(.{0,900}).*$/<3>\1/
root       413  0.0  0.0   4300  1644 ?        S    07:46   0:00      \_ /bin/sh /lkp/lkp/src/bin/run-lkp
/lkp/scheduled/xps/mdadm-selftests-18-debian-x86_64-2016-08-31.cgz-0c867962dc6e65d7242b1d10592067166cd53188-20161010-17325-1jqe222-0.yaml
root      1799  0.0  0.0   4300  1608 ?        S    07:47   0:00          \_ /bin/sh /lkp/lkp/src/bin/post-run
root      1806  0.0  0.0   4212   660 ?        S    07:47   0:00              \_ sleep 1

Signed-off-by: Philip Li <[email protected]>
  • Loading branch information
rli9 committed Oct 20, 2016
1 parent 42ebde2 commit 665f8a9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rootfs/addon/etc/init.d/lkp-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# We can install lkp-bootstrap several places, so that at least one of them can
# take effect in a particular rootfs, and the follow up ones can check reboot
# the machine if the former one failed to do so.
mkdir -p /var/lock
mkdir /var/lock/lkp-bootstrap.lock || sleep 333.3

if [ -s /var/run/lkp-bootstrap.pid ]; then
pid=$(cat /var/run/lkp-bootstrap.pid)
[ -d /proc/$pid ] && exit
Expand Down

0 comments on commit 665f8a9

Please sign in to comment.