diff options
author | Ephex2 <alexandrejoseph.tessier@gmail.com> | 2022-01-26 17:44:20 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-01-27 10:38:50 +0100 |
commit | 22055176d23417ac9039f14efdc668ed6cc6a7b9 (patch) | |
tree | d3f0af4ab9a30805872aab9075d30bd32932e24e /hugolib/page__output.go | |
parent | 7a080b624e73fe3a10cfab9ee4fa8e9b7e7c31ad (diff) |
general: Fix issue causing log threads to hang indefinitely when print() panics
The function printIfNotPrinted() defined for DistinctLogger unlocked the mutex within
the logger only after the print() function ran. If print panics, the mutex would stay
locked and future attempts to read or write from the logger mutex would cause the goroutine
to hang indefinitely.
Deferred the unlocking of the mutex to prevent this. Also, put l.m[key] before the print()
call since this will prevent another bug where the same warning potentially gets logged
multiple times if the print() call panics.
Fixes #9380
Diffstat (limited to 'hugolib/page__output.go')
0 files changed, 0 insertions, 0 deletions