spurious test failure due to race condition in allmydata.test.test_cli.Cp.test_copy_using_filecap #936
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#936
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reported by Ludovic Courtès,
http://hydra.nixos.org/build/278961/nixlog/14/raw :
allmydata.test.test_cli.Cp.test_copy_using_filecap fails with
I think this is because the test creates the "tahoe" alias (line 1000), but does not chain subsequent operations to the resulting Deferred. So, the alias might not have been created by the time it is needed.
Attachment fix-test-copy-using-filecap-darcspatch.txt (50851 bytes) added
Fix race condition in allmydata.test.test_cli.Cp.test_copy_using_filecap
Attachment fix-test-copy-using-filecap-diff.txt (1077 bytes) added
Same thing as a unified diff
looks good.
do_cli()
definitely needs to be waited upon, since it usesdeferToThread()
. All sorts of nasty race conditions if that Deferred is ignored.I would advise also changing the
open(fn1, "wb").write(DATA1)
at line 15 to explicitly close the filehandle. The file object is not obligated to flush anything until it gets GC'ed, and merely going out of scope is not enough to force that. (in practice I've never seen it behave otherwise, but that probably depends on the platform). Unfortunately the full approach is a bit verbose:Attachment fix-test-copy-using-filecap-2-darcspatch.txt (53375 bytes) added
Fix race conditions in allmydata.test.test_cli.Cp.test_copy_using_filecap, and minor cleanup
Assigning to Brian for review.
Attachment fix-test-cli-darcspatch.txt (65072 bytes) added
Previous attachment was missing some of my changes.
Hmm, trac seems to have deleted the description of the patch. It was:
allmydata.test.test_cli.Cp.test_copy_using_filecap
,Note: this now opens files in binary mode where they previously opened in text mode, but I believe that's correct.
The missing callback was
_copy_file
intest_copy_using_filecap
, which led to some of the intended checks in that test not being performed.Replying to warner:
I believe it will always behave that way in CPython (due to its use of reference counting), but not in other Python implementations.
I reviewed this patch and it looks right to me. One tiny detail is that the one-liner read and write functions in [the copy of fileutil in tahoe-lafs]source:src/allmydata/util/fileutil.py are syntactically different from those same functions in the copy of fileutil in pyutil which is too bad because it means more diffs next time I manually merge those files. (See #47 (use pyutil as a separate package and contribute src/allmydata/util/* into pyutil).)
I will apply this patch.
fixed by changeset:c984a09fe769ba4f and changeset:85a50feeaa0a6150. Thanks!