#3 Join of deamons always run in timeout

closed
7
2005-11-03
2005-11-02
Martin Zeltner
No

Hello Martin,

I'm using EL4J in my project for daemons capacities. I
think I found a bug in the code. Emmanuel Python show
the code and agree with me. But I'm not sure, can you
give me your point of view. It's a bit different for me
because I've customized AbstractDaemon and
DaemonManagerImpl.

- a DaemonManager (a) is running with for example 2
daemons (b & c).
- I want to stop daemons (b+c), so I call
doStopProcessing on (a)
- the main loop (while) in process (a) exits
- after this, in the finally clause (point y), (a)
synchronize on m_daemonManagerLock
- call cleanupDaemon (a) synchronized on
m_daemonManagerLock
- call stopRemovedDaemons (a) synchronized on
m_daemonManagerLock
- call stopAndJoinDaemons()
- call doStop on all daemons
- try to join daemons (point x)

BUT, if the daemon is working (runJob)

- finish runJob and in the finally want to send a heartbeat
- call the observer (a) receiveHeartbeat
- receiveHeartbeat (a) is synchronized on
m_daemonManagerLock <- block !

OR if the daemon is sleeping

- when it wakes up, exit main loop (while) in method
run (b)
- call sendTerminatedNormally (b)
- call terminateNormally in manager (a)
- terminateNormally (a) is synchronized on
m_daemonManagerLock <- block !

(point x)
- the join timeout is reach because all daemons are blocked
- functions returns to (point y)
- m_daemonManagerLock is free
- daemons can stop

For this case, it's not very important. All daemons
dead with a timeout. But in my case, daemons stay
blocked longer (n# daemon * timeout)

What do you think ? It's a bug ? I don't use correctly
daemon manager ?

Thanks for your feedback
Stéphane

Discussion

  • Steph
    Steph
    2005-11-03

    Logged In: YES
    user_id=1372530

    Ok, with the release 1.1 RC0 all works fine, in the standard
    case and in my project :-)

    Thanks for the fix
    Stphane

     
  • Martin Zeltner
    Martin Zeltner
    2005-11-03

    • status: open --> closed
     
  • Martin Zeltner
    Martin Zeltner
    2005-11-03

    Logged In: YES
    user_id=1103310

    Problem fixed, Gnats closed.