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
x/tools/cmd/godoc: fails with race detector enabled & large GOPATH #22110
Comments
I suspect it's this code block in godoc/index.go: for dirname := range c.fsDirnames() {
if c.IndexDirectory != nil && !c.IndexDirectory(dirname) {
continue
}
dirGate <- true
wg.Add(1)
go func(dirname string) {
defer func() { <-dirGate }()
defer wg.Done()
list, err := c.fs.ReadDir(dirname)
if err != nil {
log.Printf("ReadDir(%q): %v; skipping directory", dirname, err)
return // ignore this directory
}
for _, fi := range list {
wg.Add(1)
go func(fi os.FileInfo) {
defer wg.Done()
x.visitFile(dirname, fi)
}(fi)
}
}(dirname)
}
wg.Wait() |
Scratch that, I moved the file gate logic up above the goroutine and I'm still getting a crash. |
@kevinburke - Can you try again with the latest master ? I swear I saw this issue a few weeks earlier. But now when I am trying to repro this, it's not happening. 😞 |
Yep
godocdoc is https://github.com/kevinburke/godocdoc |
I have a really big source tree. Every GH checkout on my machine is in my GOPATH |
(Can also trigger it with |
I found it, I will submit a patch shortly
On Wed, Feb 14, 2018 at 19:56 Agniva De Sarker ***@***.***> wrote:
@kevinburke <https://github.com/kevinburke> - Can you try again with the
latest master ? I swear I saw this issue a few weeks earlier. But now when
I am trying to repro this, it's not happening. 😞
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22110 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAOSI_3KLsAGh7qRTcjrUOqss9v4Ma8Bks5tU6rVgaJpZM4Pq6z2>
.
--
…--
Kevin Burke
925.271.7005 | kev.inburke.com
|
The problem is here: func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth int) *Directory {
// ...
for _, d := range list {
filename := pathpkg.Join(path, d.Name())
switch {
case isPkgDir(d):
ch := make(chan *Directory, 1)
dirchs = append(dirchs, ch)
name := d.Name()
go func() {
ch <- b.newDirTree(fset, filename, name, depth+1)
}() Using a gate the same way as e.g. |
Ah nice. I also had a feeling that the issue would be there. 👍 |
Change https://golang.org/cl/94955 mentions this issue: |
If I build godoc commit golang/tools@68e087e with Go commit cb3dc8b and the
-race
flag, and then start godoc, I get the following error:If I set
GOPATH=/tmp
in my environment and run godoc, there are no problems, suggesting that a large number of directories in GOPATH may trigger the problem. So we may want to check ifrace
is enabled and lower the number of concurrent goroutines in that case, or permanently lower the number of concurrent goroutines.The text was updated successfully, but these errors were encountered: