natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.81k stars 593 forks source link

Ensure that the millRun goroutine terminates when Close called. #211

Open SimonRichardson opened 4 months ago

SimonRichardson commented 4 months ago

This is an attempt to upstream and complete the patch that @howbazaar started a couple of years ago.

The motivation for this patch is to move back to tracking upstream rather than an independent fork.

The original description and PR https://github.com/natefinch/lumberjack/pull/100:

Currently the millRun goroutines leaks. This is very noticeable if a Logger is constructed periodically, used and then closed. This change ensures that the millCh channel is closed if it exists. Existing log rotation tests cover the duplicate Close calls.

john8329 commented 1 month ago

This is a pretty important resource leak, @natefinch can you please take a look? I'm experiencing the same issue, no matter if I close the logger or not.

Also this is related https://github.com/natefinch/lumberjack/issues/205

Thanks

john8329 commented 1 month ago

Also this https://github.com/natefinch/lumberjack/pull/57 this https://github.com/natefinch/lumberjack/pull/80 and this https://github.com/natefinch/lumberjack/pull/90 among others, this is getting worrisome, is this library maintained?