[Ace-users] [ace-bugs] [ace-users] Thread_Timer_Queue_Adapter deadlock
Johnny Willemsen
jwillemsen at remedy.nl
Fri Feb 15 02:18:17 CST 2008
Hi,
There is an ACE_Reverse_Lock you could use for this. The question would be
whether this doesn't cause other side effects, can you store this issue in
bugzilla (see http://deuce.doc.wustl.edu/bugzilla/index.cgi)
Regards,
Johnny Willemsen
Remedy IT
Postbus 101
2650 AC Berkel en Rodenrijs
The Netherlands
www.theaceorb.nl / www.remedy.nl
*** Integrated compile and test statistics see
http://scoreboard.theaceorb.nl ***
*** Commercial service and support for ACE/TAO/CIAO ***
*** See http://www.theaceorb.nl/en/support.html ***
> > SAMPLE FIX/WORKAROUND:
> > ACE_Thread_Timer_Queue_Adapter should unlock its internal mutex
> before
> > calling expire.
>
> Actually, this alone turns out to not be enough to fix the problem,
> because the thread-safe version of ACE_Timer_Heap and I presume all
> other ACE_Timer_Queue implementations have an identical potential
> deadlock of their own.
>
> See attached test program that produces the deadlock without the
> Thread_Timer_Queue_Adapter. If you change the '#if 0' at the top to
> use ACE_SYNCH_NULL_MUTEX with ACE_Timer_Heap, the deadlock goes away.
>
> If you change ACE_Thread_Timer_Queue_Adapter as per the attached diff,
> *and* parameterize it on the ACE_SYNCH_NULL_MUTEX versions of
> ACE_Timer_Heap, no deadlocks.
>
> diff --git a/ace/Timer_Queue_Adapters.cpp
> b/ace/Timer_Queue_Adapters.cpp
> index 5876ee2..0e24dab 100644
> --- a/ace/Timer_Queue_Adapters.cpp
> +++ b/ace/Timer_Queue_Adapters.cpp
> @@ -278,8 +278,13 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::svc (void)
> }
> }
>
> + // Unlock the mutex to prevent deadlock
> + mutex_.release ();
> +
> // Expire timers anyway, at worst this is a no-op.
> this->timer_queue_->expire ();
> +
> + mutex_.acquire ();
> }
>
> // Thread cancellation point, if ACE supports it.
>
> --
> Caleb Epstein
More information about the Ace-users
mailing list