Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go/internal/lockedfile: TestTransform flaky on plan9 builder #35471

Closed
bcmills opened this issue Nov 8, 2019 · 5 comments
Closed

cmd/go/internal/lockedfile: TestTransform flaky on plan9 builder #35471

bcmills opened this issue Nov 8, 2019 · 5 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. OS-Plan9
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Nov 8, 2019

Looks like the plan9 filesystem might have an issue involving read-modify-write cycles on locked files. I'll add a skip, but leave this issue open for investigation.

--- FAIL: TestTransform (0.07s)
    transform_test.go:78: read 0 8-byte words, but each write is a power-of-2 number of words
FAIL
FAIL	cmd/go/internal/lockedfile	0.178s

CC @0intro @fhs

2019-11-08T20:24:43-bababde/plan9-386-0intro
2019-11-08T18:00:54-cfb1312/plan9-386-0intro

@bcmills bcmills added help wanted OS-Plan9 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 8, 2019
@bcmills bcmills added this to the Unplanned milestone Nov 8, 2019
@gopherbot
Copy link

Change https://golang.org/cl/206197 mentions this issue: cmd/go/internal/lockedfile: skip flaky TestTransform on plan9

gopherbot pushed a commit that referenced this issue Nov 8, 2019
Updates #35471

Change-Id: Ie06c442e405a267eb909621e1205444b6a00fda1
Reviewed-on: https://go-review.googlesource.com/c/go/+/206197
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
@fhs
Copy link
Contributor

fhs commented Nov 9, 2019

Looking at ramfs -D 9P trace, it looks like sometimes the file is being opened with the trucation bit (OTRUNC) set, and then reading from the file returns 0 bytes. Topen for fid 718 below has mode 18 (OTRUNC | ORDWR). What could cause the OTRUNC bit to be set?

ramfs 164743:<-Twalk tag 43 fid 729 newfid 718 nwname 1 0:blob.bin 
ramfs 164743:->Rwalk tag 43 nwqid 1 0:(0000000000000002 109 ) 
ramfs 164743:<-Tclunk tag 9 fid 692
ramfs 164743:->Rclunk tag 9
ramfs 164743:<-Tclunk tag 43 fid 729
ramfs 164743:->Rclunk tag 43
ramfs 164743:<-Twalk tag 9 fid 721 newfid 692 nwname 2 0:TestTransform617877035 1:blob.bin 
ramfs 164743:->Rwalk tag 9 nwqid 2 0:(0000000000000001 0 d) 1:(0000000000000002 109 ) 
ramfs 164743:<-Topen tag 43 fid 718 mode 18
ramfs 164743:->Ropen tag 43 qid (0000000000000002 110 ) iounit 16384 
ramfs 164743:<-Topen tag 9 fid 692 mode 2
ramfs 164743:->Rerror tag 9 ename exclusive use file already open
ramfs 164743:<-Tread tag 43 fid 718 offset 0 count 512
ramfs 164743:->Rread tag 43 count 0 ''
ramfs 164743:<-Tclunk tag 9 fid 692
ramfs 164743:->Rclunk tag 9
ramfs 164743:<-Tclunk tag 9 fid 718
ramfs 164743:->Rclunk tag 9

@fhs
Copy link
Contributor

fhs commented Nov 9, 2019

I think I understand where the OTRUNC is coming from. Transform calls Edit, which is using os.Open with os.O_RDWR|os.O_CREATE. os.Open first tries to open the file but it fails to acquire the file lock. Then, because of the O_CREATE, it tries to create the file (this line), and luckily we get the file lock this time. The kernel probably added the OTRUNC and apparently a create syscall can generate a Topen 9P message.

I think the issue here is that os.Open assumes that a failed syscall.Open means the file does not exist and it tries to create it. It shouldn't try to create the file if open fails for other reason, such as locked file in this case.

@fhs
Copy link
Contributor

fhs commented Nov 9, 2019

I'm working on a CL.

@gopherbot, please add label NeedsFix and remove label NeedsInvestigation

@gopherbot gopherbot added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 9, 2019
@gopherbot
Copy link

Change https://golang.org/cl/206299 mentions this issue: cmd/go/internal/lockedfile, os: fix O_CREATE flag on Plan 9

@golang golang locked and limited conversation to collaborators Nov 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. OS-Plan9
Projects
None yet
Development

No branches or pull requests

3 participants