[asterisk-bugs] [Asterisk 0010052]: NOTIFY race condition when state changes happen very fast

noreply at bugs.digium.com noreply at bugs.digium.com
Wed Nov 28 09:28:31 CST 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10052 
====================================================================== 
Reported By:                raarts
Assigned To:                file
====================================================================== 
Project:                    Asterisk
Issue ID:                   10052
Category:                   Channels/chan_sip/Registration
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:            1.2.19  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        Yes 
Request Review:              
====================================================================== 
Date Submitted:             06-25-2007 08:47 CDT
Last Modified:              11-28-2007 09:28 CST
====================================================================== 
Summary:                    NOTIFY race condition when state changes happen very
fast
Description: 
This particular problem was encountered with SNOM360 phones, but it is not
specific to it.

What happens:
- SNOM has subscribed a LED to another phone
- SNOM user dials this other phone. 
- dialplan adds an answer-after=0 SIP header.
- asterisk send INVITE to the other phone
- other phone send back RINGING, this is sent back to the SNOM as well
- asterisk send NOTIFY 'early' to the SNOM
- meanwhile, the other phone answers very quickly
- asterisk sends OK to INVITE to SNOM to indicate the other phone 
  has answered the line, and immediately after that, a NOTIFY 'confirmed'.

  At this point in time the OK to the previous NOTIFY 'early' has not 
  been sent yet by the SNOM.

Now the system is confused, because the SNOM finally sends the OK
to the NOTIFY 'early', but asterisk is only expecting an OK to the
last sent NOTIFY, and starts retrying. See attached trace.

I think asterisk should not sent a new NOTIFY. I think ideally NOTIFY's
should be queued on a per-channel basis. Or should asterisk remember
earlier



====================================================================== 

---------------------------------------------------------------------- 
 oej - 11-28-07 09:28  
---------------------------------------------------------------------- 
Ok, I suspected there was a problem with the lights, but it wasn't clear in
the report.

So in fact, cancelling the existing transaction, so that the previous
state is not transmitted after the most recent one would solve the issue
too and be a better solution.

I'm happy that the patch works, but like many patches, it's solving one
issue and may cause others in other situations. I need to analyze that in
order to be sure on what to do, but the most efficient way as I see it is
to make sure that the list of outstanding NOTIFY transactions is simply
cancelled whenever we have a new update. That wouldn't confuse any phone.
Asterisk might reveive a 200 OK on a Notify that is not in the list any
more, but that wouldn't hurt anything either, just cause a log message.
That's way better than having a series of christmas lights on the sidecar.

The phones should also be a bit more intelligent and observe the Cseq and
not bother with turning any lamps on when an obvious retransmit arrives,
but that's a different issue... :-) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
11-28-07 09:28  oej            Note Added: 0074473                          
======================================================================




More information about the asterisk-bugs mailing list