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

Data race in logp.(*FileRotator) #5131

Closed
nrvnrvn opened this issue Sep 7, 2017 · 4 comments
Closed

Data race in logp.(*FileRotator) #5131

nrvnrvn opened this issue Sep 7, 2017 · 4 comments

Comments

@nrvnrvn
Copy link
Contributor

nrvnrvn commented Sep 7, 2017

Seen in https://github.com/mheese/journalbeat/issues/108
A workaround is to turn off logging to files.

==================
WARNING: DATA RACE
Read at 0x00c420139d60 by main goroutine:
  os.(*File).Write()
      /root/.gimme/versions/go1.8.linux.amd64/src/os/file.go:139 +0x70
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.(*FileRotator).WriteLine()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/file_rotator.go:71 +0x138
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.send()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/log.go:90 +0x235
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.msg()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/log.go:115 +0xbf
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.Info()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/log.go:120 +0x7e
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat.(*Beat).launch()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:221 +0x934
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat.Run()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:141 +0x72
  main.main()
      /go/src/github.com/mheese/journalbeat/main.go:25 +0x65

Previous write at 0x00c420139d60 by goroutine 17:
  os.NewFile()
      /root/.gimme/versions/go1.8.linux.amd64/src/os/file_unix.go:56 +0x85
  os.OpenFile()
      /root/.gimme/versions/go1.8.linux.amd64/src/os/file_unix.go:123 +0x21b
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.(*FileRotator).Rotate()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/file_rotator.go:148 +0x1ae
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.(*FileRotator).WriteLine()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/file_rotator.go:64 +0x260
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.send()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/log.go:90 +0x235
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.msg()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/log.go:115 +0xbf
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.Info()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/log.go:120 +0x7e
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.logMetrics()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/metrics.go:23 +0x12f

Goroutine 17 (running) created at:
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp.Init()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/logp/logp.go:161 +0x386
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat.(*Beat).configure()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:277 +0x422
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat.(*Beat).launch()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:170 +0xcb
  github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat.Run()
      /go/src/github.com/mheese/journalbeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:141 +0x72
  main.main()
      /go/src/github.com/mheese/journalbeat/main.go:25 +0x65
==================
@ph
Copy link
Contributor

ph commented Oct 11, 2017

I am able to reproduce that issue in the 5.6 branch, I'll do a bit more digging, I have seen that you have referenced this issue https://github.com/mheese/journalbeat/issues/100 as the fix, but it doesn't seem to work on my side.

@ph ph self-assigned this Oct 11, 2017
@ph
Copy link
Contributor

ph commented Oct 11, 2017

This race has been fixed in #4519, but the commit only went into master. @exekias Can you backport that to 5.6?

@ph ph removed their assignment Oct 12, 2017
@exekias
Copy link
Contributor

exekias commented Oct 18, 2017

Just opened #5409, sorry for the delay, I missed this ping somehow 😇

@ph
Copy link
Contributor

ph commented Oct 23, 2017

#5409 was merged in the 5.6 branch, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants