Skip to content

syscall: effect of Chdir in Plan 9 may not be simultaneous to all goroutines #58802

@millerresearch

Description

@millerresearch

CL 6350 added a syscall.Fixwd routine to ensure that a Chdir in one goroutine is propagated to other goroutines before the working directory is referenced in a subsequent syscall. This is needed because each M in Plan 9 runs as a separate OS process with its own working directory.

This mechanism turns out to be not quite sufficient to guarantee that Chdir is effectively program wide. It may be frustrated by preemption of a goroutine and rescheduling onto a different M at an inopportune moment.

Circumstantial evidence includes test failures like this with messages like './testdata' file does not exist', and the observation by @psilva261 in the discussion of #57540 that inserting some runtime.LockOSThread calls around Fixwd makes "fs related tests ... much more stable".

I've also found that if the os.TestProgWideChdir test is made slightly more aggressive, it will
sometimes report errors.

Metadata

Metadata

Labels

FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Plan9compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions