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

Comments

@bcmills
Copy link
Member

@bcmills 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

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 8, 2019

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

This comment has been minimized.

Copy link
Contributor

@fhs 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

This comment has been minimized.

Copy link
Contributor

@fhs 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

This comment has been minimized.

Copy link
Contributor

@fhs fhs commented Nov 9, 2019

I'm working on a CL.

@gopherbot, please add label NeedsFix and remove label NeedsInvestigation

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 9, 2019

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

@gopherbot gopherbot closed this in 78d4560 Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.