Re: [Sofia-sip-devel] Crash when system time jumps

2014-06-12 Thread Michael Jerris
My patch to fix this issue:

commit f50f04be51f0e43a20ac2dceef1a8115d76dbb25
Author: Michael Jerris m...@jerris.com
Date:   Fri Mar 28 14:33:47 2014 -0400

FS-6356: --resolve fix assert when you set the time  15 days in the future 
during operation while things are in queue to be processeed

diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c 
b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
index 9a357a9..d1a3e68 100644
--- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
+++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
@@ -1280,18 +1280,16 @@ void agent_timer(su_root_magic_t *rm, su_timer_t 
*timer, nta_agent_t *agent)
 
   if (next == latest) {
 /* Do not set timer? */
+   /* check it there are still things queued, if there are, that means 
everything scheduled is  15 days in the future */
+/* in this case, we had a large time shift, we should schedule for 15 days 
in the future (which is probably still before now) */
+   /* and this should sort itself out on the next run through */
+if ( !agent-sa_out.completed-q_head  !agent-sa_out.trying-q_head  
!agent-sa_out.inv_calling-q_head 
+!agent-sa_out.re_list  !agent-sa_in.inv_confirmed-q_head 
 !agent-sa_in.preliminary-q_head 
+!agent-sa_in.completed-q_head  
!agent-sa_in.inv_completed-q_head  !agent-sa_in.re_list ) {
SU_DEBUG_9((nta: timer not set\n VA_NONE));
-assert(!agent-sa_out.completed-q_head);
-assert(!agent-sa_out.trying-q_head);
-assert(!agent-sa_out.inv_calling-q_head);
-assert(!agent-sa_out.re_list);
-assert(!agent-sa_in.inv_confirmed-q_head);
-assert(!agent-sa_in.preliminary-q_head);
-assert(!agent-sa_in.completed-q_head);
-assert(!agent-sa_in.inv_completed-q_head);
-assert(!agent-sa_in.re_list);
return;
}
+  }
 
   if (next == now) if (++next == 0) ++next;

On Jun 12, 2014, at 7:08 AM, Craig McQueen 
craig.mcqu...@beamcommunications.com wrote:

 
 I'm working on a SIP SUBSCRIBE/NOTIFY server using Sofia-SIP 1.12.11. It is 
 running on an isolated system which synchronises time from satellites. When 
 the time is obtained, and the system time jumps (e.g. from Unix time value 
 200 to Unix time value 1402307300), then the program aborts with an assertion:
 
 sip-server: nta.c:1280: agent_timer: Assertion 
 `!agent-sa_in.completed-q_head' failed.
 Aborted
 
 It looks as though agent_timer() in nta.c is written with an implicit 
 requirement that the system time doesn't jump. It is deriving a wrapping 
 signed 32-bit millisecond timer value from the system time. If the system 
 time jumps suddenly, then that may trigger the assert. I'm not sure exactly 
 what time values will trigger it. It looks as though it should happen if the 
 millisecond timer changes by roughly 2³¹ or more, but my test data isn't 
 conclusive.
 
 What is a good way to resolve this?
 
 Ideally, it would be good if Sofia-SIP would use a monotonically increasing 
 timer instead, using the su_monotime() function. I'm not sure how major a 
 change this is, and whether it would be accepted into the Sofia-SIP project 
 (where is the official repository for Sofia-SIP development now?).
 
 If system time is used, then firstly the assert should be avoided. Secondly, 
 there is a question of whether time delays can be accurately preserved, or 
 whether time delays may trigger prematurely.
 
 Regards,
 Craig McQueen
 
 --
 HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
 Find What Matters Most in Your Big Data with HPCC Systems
 Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
 Leverages Graph Analysis for Fast Processing  Easy Data Exploration
 http://p.sf.net/sfu/hpccsystems
 ___
 Sofia-sip-devel mailing list
 Sofia-sip-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] Crash when system time jumps

2014-06-12 Thread Andreas Wehrmann

On 06/12/2014 02:30 PM, Michael Jerris wrote:
 +   /* check it there are still things queued, if there are, that means 
 everything scheduled is  15 days in the future */
 +/* in this case, we had a large time shift, we should schedule for 15 
 days in the future (which is probably still before now) */
 +   /* and this should sort itself out on the next run through */
 +if ( !agent-sa_out.completed-q_head  !agent-sa_out.trying-q_head 
  !agent-sa_out.inv_calling-q_head 
 +!agent-sa_out.re_list  
 !agent-sa_in.inv_confirmed-q_head  !agent-sa_in.preliminary-q_head 
 +!agent-sa_in.completed-q_head  
 !agent-sa_in.inv_completed-q_head  !agent-sa_in.re_list ) {
  SU_DEBUG_9((nta: timer not set\n VA_NONE));

Thanks for the patch.
I wasn't even aware of this issue.

Regards,
Andreas


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] Crash when system time jumps

2014-06-12 Thread Michael Jerris
it only happens with time shifts  15 days and only in one direction.  We 
stumbled on it when testing daylight savings time changes when we were 
intentionally changing the time to be months off just before the time change.

Mike

On Jun 12, 2014, at 1:20 PM, Andreas Wehrmann andreas_wehrm...@yahoo.at wrote:

 
 On 06/12/2014 02:30 PM, Michael Jerris wrote:
 +   /* check it there are still things queued, if there are, that means 
 everything scheduled is  15 days in the future */
 +/* in this case, we had a large time shift, we should schedule for 15 
 days in the future (which is probably still before now) */
 +   /* and this should sort itself out on the next run through */
 +if ( !agent-sa_out.completed-q_head  !agent-sa_out.trying-q_head 
  !agent-sa_out.inv_calling-q_head 
 +!agent-sa_out.re_list  
 !agent-sa_in.inv_confirmed-q_head  !agent-sa_in.preliminary-q_head 
 +!agent-sa_in.completed-q_head  
 !agent-sa_in.inv_completed-q_head  !agent-sa_in.re_list ) {
 SU_DEBUG_9((nta: timer not set\n VA_NONE));
 
 Thanks for the patch.
 I wasn't even aware of this issue.
 
 Regards,
 Andreas
 
 
 --
 HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
 Find What Matters Most in Your Big Data with HPCC Systems
 Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
 Leverages Graph Analysis for Fast Processing  Easy Data Exploration
 http://p.sf.net/sfu/hpccsystems
 ___
 Sofia-sip-devel mailing list
 Sofia-sip-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel