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

fatal error: concurrent map read and map write #38

Closed
htfy96 opened this issue Mar 6, 2018 · 2 comments
Closed

fatal error: concurrent map read and map write #38

htfy96 opened this issue Mar 6, 2018 · 2 comments
Assignees
Labels

Comments

@htfy96
Copy link
Contributor

htfy96 commented Mar 6, 2018

Captured by our monitor system.

goroutine 1 [running]:
runtime.throw(0x958490, 0x21)
	/usr/local/go/src/runtime/panic.go:605 +0x95 fp=0xc4200578c8 sp=0xc4200578a8 pc=0x42c7a5
runtime.mapaccess1_faststr(0x8c3060, 0xc4208a4690, 0x947188, 0x5, 0x891680)
	/usr/local/go/src/runtime/hashmap_fast.go:217 +0x43a fp=0xc420057920 sp=0xc4200578c8 pc=0x40d2ea
github.com/sjtug/lug/vendor/github.com/sirupsen/logrus.(*TextFormatter).Format(0xc4200f0220, 0xc4202a6a80, 0xc4202a6a80, 0xc420057ae8, 0x6c8d84, 0xc4201d00c0, 0xc4202a6a80)
	/go/src/github.com/sjtug/lug/vendor/github.com/sirupsen/logrus/text_formatter.go:91 +0x454 fp=0xc420057a80 sp=0xc420057920 pc=0x6caee4
github.com/sjtug/lug/vendor/github.com/sirupsen/logrus.(*Entry).Reader(0xc4202a6a80, 0x341994b1b04, 0xc4202a6a80, 0x0)
	/go/src/github.com/sjtug/lug/vendor/github.com/sirupsen/logrus/entry.go:44 +0x40 fp=0xc420057af8 sp=0xc420057a80 pc=0x6c6890
github.com/sjtug/lug/vendor/github.com/sirupsen/logrus.Entry.log(0xc4200661c0, 0xc4208a4690, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0xc4202920a0, ...)
	/go/src/github.com/sjtug/lug/vendor/github.com/sirupsen/logrus/entry.go:94 +0x117 fp=0xc420057bb8 sp=0xc420057af8 pc=0x6c7017
github.com/sjtug/lug/vendor/github.com/sirupsen/logrus.(*Entry).Info(0xc4202a6a40, 0xc420057d98, 0x1, 0x1)
	/go/src/github.com/sjtug/lug/vendor/github.com/sirupsen/logrus/entry.go:129 +0x9a fp=0xc420057c20 sp=0xc420057bb8 pc=0x6c754a
github.com/sjtug/lug/manager.(*Manager).Run(0xc42019ca80)
	/go/src/github.com/sjtug/lug/manager/manager.go:105 +0xf55 fp=0xc420057f20 sp=0xc420057c20 pc=0x83c885
main.main()
	/go/src/github.com/sjtug/lug/main.go:110 +0x104 fp=0xc420057f80 sp=0xc420057f20 pc=0x83e5c4
runtime.main()
	/usr/local/go/src/runtime/proc.go:195 +0x226 fp=0xc420057fe0 sp=0xc420057f80 pc=0x42de96
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420057fe8 sp=0xc420057fe0 pc=0x45a611
@htfy96 htfy96 added the bug label Mar 6, 2018
@htfy96 htfy96 self-assigned this Mar 6, 2018
@htfy96
Copy link
Contributor Author

htfy96 commented Mar 6, 2018

Refs:

sirupsen/logrus#468
sirupsen/logrus#364

Go race detector:

==================
WARNING: DATA RACE
Read at 0x00c4201e2a50 by main goroutine:
  github.com/sjtug/lug/worker.(*RsyncWorker).GetStatus()
      /home/lz/code/gopath/src/github.com/sjtug/lug/worker/rsync_worker.go:65 +0x13d
  github.com/sjtug/lug/manager.(*Manager).Run()
      /home/lz/code/gopath/src/github.com/sjtug/lug/manager/manager.go:82 +0xdef
  main.main()
      /home/lz/code/gopath/src/github.com/sjtug/lug/main.go:110 +0x158

Previous write at 0x00c4201e2a50 by goroutine 13:
  github.com/sjtug/lug/worker.(*RsyncWorker).RunSync()
      /home/lz/code/gopath/src/github.com/sjtug/lug/worker/rsync_worker.go:87 +0x81b

Goroutine 13 (running) created at:
  github.com/sjtug/lug/manager.(*Manager).Run()
      /home/lz/code/gopath/src/github.com/sjtug/lug/manager/manager.go:73 +0x33a
  main.main()
      /home/lz/code/gopath/src/github.com/sjtug/lug/main.go:110 +0x158
==================

@htfy96 htfy96 mentioned this issue Mar 6, 2018
2 tasks
@htfy96
Copy link
Contributor Author

htfy96 commented Mar 6, 2018

After some research, I found that Fire of logrustash will keep an entry *logrus.Entry and write entry.Data at https://github.com/cheshir/logrustash/blob/master/logstash.go#L221 . Unfortunately, at the same time this entry may also be read by textFormatter at logrus.

This has been fixed by logrus upstream at sirupsen/logrus@be56909#diff-32f22e4789509e4288e8ee93f532fbd0

@htfy96 htfy96 closed this as completed in #39 Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant