[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dd: reblock failure -- sporadic failures
From: |
Jim Meyering |
Subject: |
Re: dd: reblock failure -- sporadic failures |
Date: |
Sun, 30 Nov 2008 18:50:22 +0100 |
Bob Proulx <address@hidden> wrote:
> This seems very strange. Periodically I have seen the dd reblock test
> fail. It isn't a hard failure and that seems like a critical clue to
> me. But it also seems quite strange.
>
> http://buildbot.proulx.com:9000/i686-gnu-linux-full/builds/990/step-test/0
>
> + dd bs=3 ibs=1 obs=1
> ...
> + diff -u err exp-no-reblock
> --- err 2008-11-29 07:07:22.000000000 -0700
> +++ exp-no-reblock 2008-11-29 07:07:21.000000000 -0700
> @@ -1,3 +1,3 @@
> -1+1 records in
> -1+1 records out
> +0+2 records in
> +0+2 records out
> 4 bytes (4 B) copied
> + fail=1
Hi Bob,
This should fix it in most cases.
There will always be a race when the consumer can start
far later than the producer.
I demonstrated the failure locally by using a shorter sleep interval:
while :; do printf .;(echo x; sleep .01; echo y) \
| dd bs=3 ibs=1 obs=1 2>&1 |grep -F '1+1 records in' && break; done
..........................................................................\
..........................................................................\
..........................................................................\
..............................................1+1 records in
Here's the fix in my queue:
>From 149a55b6ff4137668b9a945fa6cab30bdd7933ea Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 30 Nov 2008 18:43:55 +0100
Subject: [PATCH] tests: avoid occasional dd/reblock failure
* tests/dd/reblock: Sleep longer to avoid a race condition.
Reported by Bob Proulx.
---
tests/dd/reblock | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tests/dd/reblock b/tests/dd/reblock
index 542529a..ef9e036 100755
--- a/tests/dd/reblock
+++ b/tests/dd/reblock
@@ -44,7 +44,10 @@ sed 's/,.*//' err > k && mv k err
compare err exp-reblock || fail=1
# Demonstrate that bs=N supersedes even following ibs= and obs= settings.
-(echo x; sleep .1; echo y) | dd bs=3 ibs=1 obs=1 > out 2> err || fail=1
+# Choosing a delay of 0.1 would result in an occasional lost race where
+# the consumer's first read would consume 3 bytes rather than the expected 2.
+# Not wanting to sleep a full second, I'll raise that to 0.3.
+(printf ab; sleep .3; printf cd) | dd bs=3 ibs=1 obs=1 > out 2> err || fail=1
sed 's/,.*//' err > k && mv k err
compare err exp-no-reblock || fail=1
--
1.6.0.4.1101.g642f8