{"thread":{"id":"39188","subject":"[PATCH] git-p4: Fix ocasional test failures in kill_p4d","startedAt":"2015-04-29T21:26:08Z","lastAt":"2015-04-29T21:26:09Z","messageCount":2,"participants":["Luke Diamand"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"260209","messageId":"1430342769-20521-1-git-send-email-luke@diamand.org","threadId":"39188","inReplyTo":null,"subject":"[PATCH] git-p4: Fix ocasional test failures in kill_p4d","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2015-04-29T21:26:08Z","receivedAt":"2015-04-29T21:26:08Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Running the git-p4 unit tests, I notice that the 'kill_p4d' test\noccasionally fails. This just terminates the p4d server, so in\ntheory it should always succeed. The problem is especially\nnoticeable when running multiple tests in parallel:\n\n    $ make -C t T=t98*.sh -j50\n\nThat's annoying, as it makes it harder to test changes to git-p4.\n\nIt looks like p4d is sensitive to being killed ungracefully.\nExperimentally, I find that starting it with journalling disabled,\nand using 'p4 admin stop' rather than kill(1) makes the process much\nmore reliable; I no longer see the intermittent failures.\n\n\nLuke Diamand (1):\n  git-p4: fix occasional test failure in kill_p4d\n\n t/lib-git-p4.sh | 15 ++++++++-------\n 1 file changed, 8 insertions(+), 7 deletions(-)\n\n-- \n2.3.4.48.g223ab37\n"},{"id":"260210","messageId":"1430342769-20521-2-git-send-email-luke@diamand.org","threadId":"39188","inReplyTo":"1430342769-20521-1-git-send-email-luke@diamand.org","subject":"[PATCH] git-p4: fix occasional test failure in kill_p4d","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2015-04-29T21:26:09Z","receivedAt":"2015-04-29T21:26:09Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"The kill_p4d test function used in the test harness fails\noccasionally, especially if running many of the git-p4 tests\nin parallel.\n\nIt looks like p4d is sensitive to being shutdown ungracefully,\nso to work around this, use 'p4 admin stop' rather than kill,\nand start p4d with journalling turned off. This seems to be much\nmore reliable.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n t/lib-git-p4.sh | 15 ++++++++-------\n 1 file changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh\nindex 5aa8adc..3885381 100644\n--- a/t/lib-git-p4.sh\n+++ b/t/lib-git-p4.sh\n@@ -69,7 +69,8 @@ start_p4d() {\n \t(\n \t\tcd \"$db\" &&\n \t\t{\n-\t\t\tp4d -q -p $P4DPORT &\n+\t\t\t# disable journalling: it makes shutdown unreliable\n+\t\t\tp4d -J off -q -p $P4DPORT &\n \t\t\techo $! >\"$pidfile\"\n \t\t}\n \t) &&\n@@ -122,15 +123,15 @@ p4_add_user() {\n }\n \n kill_p4d() {\n-\tpid=$(cat \"$pidfile\")\n-\t# it had better exist for the first kill\n-\tkill $pid &&\n-\tfor i in 1 2 3 4 5 ; do\n-\t\tkill $pid >/dev/null 2>&1 || break\n+\t# graceful shutdown\n+\tp4 admin stop &&\n+\tfor i in 1 2 3 4 5\n+\tdo\n+\t\tp4 info >/dev/null 2>&1 || break\n \t\tsleep 1\n \tdone &&\n \t# complain if it would not die\n-\ttest_must_fail kill $pid >/dev/null 2>&1 &&\n+\ttest_must_fail p4 info 2>&1 >/dev/null &&\n \trm -rf \"$db\" \"$cli\" \"$pidfile\"\n }\n \n-- \n2.3.4.48.g223ab37\n"}]}