ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.16k stars 3.01k forks source link

fuse t0030-mount.sh regression #1369

Closed chriscool closed 9 years ago

chriscool commented 9 years ago

These days when running the sharness tests on my Linux machine, I always get the following test failure:

expecting success: 
    test_must_be_empty output &&
    test_should_contain "not_ipns\|not_ipfs" output.err

'output.err' does not contain 'not_ipns\|not_ipfs', it contains:
Error: fusermount: exit status 1
not ok 7 - 'ipfs mount' output looks good
#
#               test_must_be_empty output &&
#               test_should_contain "not_ipns\|not_ipfs" output.err
#

Bisecting this failure points to the following commit that updates a dependency:

commit e9074beb6da592a203ddcea3e4a22dd9c0af13fb Author: Henry cryptix@riseup.net Date: Thu May 28 22:09:26 2015 +0200

godeps: update bazil.org/fuse

fuse: Attr() now has a Context parameter and error return value

~GOPATH/src/bazil.org/fuse:master$ git shortlog 48c34fb7780b88aca1696bf865508f6703aa47f1..e4fcc9a2c7567d1c42861deebeb483315d222262
Tommi Virtanen (8):
      Remove dead code
      Make saveLookup take Context, return error
      Make serveNode.attr take Context, return error
      Make nodeAttr take Context, return error
      API change: Move attribute validity time inside Attr
      Set attribute validity default time in one place
      API change: Attr method takes Context, returns error
      Set LookupResponse validity times up front, instead of after the handler

cc @cryptix @tv42

tv42 commented 9 years ago

That's a race, it's likely unmounting too soon and the mount point is still busy. The commit involved should have no real change on the behavior, apart from the race coming & going as a random side effect.

In bazil.org/fuse's own unit tests, I do this https://github.com/bazil/fuse/blob/4fe24646670059b759e9a2b06a37384b7877f166/fs/fstestutil/mounted.go#L37 and regularly see a few of those messages, with the loop retrying 0-2 times before the unmount succeeds.

I am not aware of any mechanism to wait until a mount point is not-busy.

chriscool commented 9 years ago

The test in t0030 is the following:

test_expect_success "'ipfs mount' fails when there is no mount dir" '
    tmp_ipfs_mount() { ipfs mount -f=not_ipfs -n=not_ipns >output 2>output.err; } &&
    test_must_fail tmp_ipfs_mount
'

test_expect_success "'ipfs mount' output looks good" '
    test_must_be_empty output &&
    test_should_contain "not_ipns\|not_ipfs" output.err
'

So we are checking that ipfs mount will report an error like "cannot mount not_ipfs" when it cannot mount because the specified directory does not exist. Instead we get "Error: fusermount: exit status 1". So we get an error but it's not a nice error for the user.

It doesn't look like a race problem for me and it doesn't look like an unmounting problem.

tv42 commented 9 years ago

Oh sorry, I jumped the gun. I usually see fusermount complaining at unmount time, and have seen that with sharness.

jbenet commented 9 years ago

tv42 commented 9 years ago

I really have no idea what that test wants to test, but it seems to testing some detail of error message content that's in no way guaranteed.

jbenet commented 9 years ago

@tv42

what i'm asking you is whether you intend for the message to have changed. fuse used to return an error like

fusermount: "fusermount: <msg-including-path>" exit status 1

so we removed the wrapping and returned the raw <msg-including-path>.

do your latest changes intend for the (helpful) <msg-including-path> to be replaced by the (obscure) fusermount: exit status 1?? (If so, we'll craft our own helpful message another way, but just checking because you may want to have a better UX there.)

tv42 commented 9 years ago

That's /bin/fusermount not my code.

jbenet commented 9 years ago

ok we'll fix it on our end-- sorry to bother :)

tv42 commented 9 years ago

Well, it's more, fusermount doesn't give a nice error to stderr for me to use.

https://github.com/bazil/fuse/commit/d28b015fbc4824368118e16ce3a1a11f4979b3dd switched from capturing stderr and returning it as an error to just logging them, as fusermount was observed sending frivolous messages to stderr.

I'm sure that could be done somehow better, but there's bigger fish to fry for now.