7max/log4cl

JOIN-THREAD-ERROR

Closed this issue · 3 comments

knobo commented

What is going on here?

$ sbcl

* (ql:quickload "log4cl" :silent t)
* (log4cl:start-hierarchy-watcher-thread)
* (LOG4CL-IMPL::SAVE-HOOK)
ERROR - Caught SB-THREAD:JOIN-THREAD-ERROR during
        '(LOG4CL-IMPL:STOP-HIERARCHY-WATCHER-THREAD :JOIN-THREAD):
        Joining thread failed: thread #<THREAD "Hierarchy Watcher" ABORTED

                                        {10054D0CE3}> did not return normally.;
        Continuing.
knobo commented

I checked out some git commits

e03418f
With this one I don't get any error message

cc21b0c
With this one I get #<SB-THREAD:JOIN-THREAD-ERROR {1005457DC3}>

I have tried this on sbcl-1.2.8 up til sbcl-1.3.5 (not all of them, though)

The code

(ql:quickload "log4cl")
(log4cl:start-hierarchy-watcher-thread)
(log4cl::stop-hierarchy-watcher-thread)   
knobo commented

Maybe in start-hierarchy-watcher-thread

(sleep *hierarchy-watcher-heartbeat*)

could be exchanged with something like:

(bt:with-lock-held (*lock*)
  (when (bt:condition-wait  *condition* *lock* :timeout *hierarchy-watcher-heartbeat*)
    (return-from start-hierarchy-watcher-thread)))

and in log4cl::stop-hierarchy-watcher-thread

bt::destroy-thread

could be exchanged with something like

(bt:condition-notify *condition*)

knobo commented

Or, maybe we don't need any locking mechanism to send a stop-signal to the server. Just (setf stop-server t), and then (when stop-server (return-fom.....))?