fzakaria / slf4j-timbre

SLF4J binding for Clojure's Timbre
Eclipse Public License 1.0
94 stars 23 forks source link

fix race condition in factory that allowed to return null #35

Closed xificurC closed 4 years ago

xificurC commented 4 years ago

the compare-and-set! call doesn't guarantee it is our logger that has been changed in the state map. If we don't want to change the logger in the state map we should call swap! with update and use the result.

As a safe-guard I've put a throw in. Returning null from getLogger caused me to debug for 4 hours where the issue lies. This will help others to pinpoint us in case the code messes up again :)

rufoa commented 4 years ago

Well spotted! Sorry this caused you problems.

Thanks for your patch, which I used as the basis for my changes in https://github.com/fzakaria/slf4j-timbre/commit/694f2a14f5c2b60119c5ebfeedf7388f4150a9ca

I've pushed a new version to clojars as 0.3.14. Please let me know if you have any further problems.