-
Notifications
You must be signed in to change notification settings - Fork 45
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
Dead lock detected? #33
Comments
thx for your report.
I will investigate on it
Have an awesome day
✉️✉️✉️✉️✉️✉️✉️✉️✉️✉️✉️✉️
Arthur lee
Sent from my iPhone
… 在 2021年8月24日,下午8:55,Kelvin Hu ***@***.***> 写道:
Thanks for the great package! We use it with zerolog, and it works well, however we met a bug recently, large amount of goroutines hang at writing log, all with the following stack trace:
(dlv) bt
0 0x0000000000439405 in runtime.gopark
at go/src/runtime/proc.go:337
1 0x000000000044a385 in runtime.goparkunlock
at go/src/runtime/proc.go:342
2 0x000000000044a385 in runtime.semacquire1
at go/src/runtime/sema.go:144
3 0x0000000000468967 in sync.runtime_SemacquireMutex
at go/src/runtime/sema.go:71
4 0x00000000004721e5 in sync.(*Mutex).lockSlow
at go/src/sync/mutex.go:138
5 0x0000000000b4ee0b in sync.(*Mutex).Lock
at go/src/sync/mutex.go:81
6 0x0000000000b4ee0b in github.com/arthurkiller/rollingwriter.(*LockedWriter).Write
at ***@***.***/writer.go:254
7 0x0000000000695703 in github.com/rs/zerolog.levelWriterAdapter.WriteLevel
at ***@***.***/writer.go:20
8 0x0000000000695703 in github.com/rs/zerolog.(*levelWriterAdapter).WriteLevel
at <autogenerated>:1
9 0x0000000000689625 in github.com/rs/zerolog.(*Event).write
at ***@***.***/event.go:76
10 0x0000000000689b1b in github.com/rs/zerolog.(*Event).msg
at ***@***.***/event.go:140
11 0x0000000000b39f70 in github.com/rs/zerolog.(*Event).Msg
at ***@***.***/event.go:106
...
I'm not familiar with the code, however, after a quick search, I found the following suspicious function:
func (w *LockedWriter) Write(b []byte) (n int, err error) {
w.Lock()
select {
case filename := <-w.fire:
if err := w.Reopen(filename); err != nil {
return 0, err // <-- here
}
default:
}
n, err = w.file.Write(b)
w.Unlock()
return
}
I don't know if there is a chance that the function returns at the comment line, leaves the lock acquired without release. Is this the root cause of the bug above? Any help is appreciated, thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I have reproduced the problem:
It is indeed because the code snippet I posted above does not release the lock when |
good catch, thx alot |
Shall we bump a new hotfix version v1.1.3, with this fix included? |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the great package! We use it with zerolog, and it works well, however we met a bug recently, large amount of goroutines hang at writing log, all with the following stack trace:
I'm not familiar with the code, however, after a quick search, I found the following suspicious function:
I don't know if there is a chance that the function returns at the comment line, leaves the lock acquired without release. Is this the root cause of the bug above? Any help is appreciated, thanks.
The text was updated successfully, but these errors were encountered: