From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: timeouts
Date: Thu, 19 Aug 2004 03:40:46 GMT
Date: 2004-08-19T03:40:46+00:00 [thread overview]
Message-ID: <2jVUc.13319$Fg5.12445@attbi_s53> (raw)
In-Reply-To: sa4smakuhzq.fsf@snoopy.apana.org.au
What version of GNAT?
I vaguely recall a gnat bug having to do with time. Unfortunately I can't
recall the particulars. Maybe someone else on the list will remember.
Steve
(The Duck)
"Brian May" <bam@snoopy.apana.org.au> wrote in message
news:sa4smakuhzq.fsf@snoopy.apana.org.au...
> Hello,
>
> I have a written a communications protocols, for Windows, in Ada,
> using the GNAT compiler for Windows. This is my attempt at
> implementing the MAP27 protocol (used for talking to trunk radios).
>
> The main protocol is implemented as a separate task along the lines of
> the following code. This code is simplified from my actual code, and
> only shows the what I consider relevant to this bug, based on print
> messages. Any mistakes in syntax are probably copy errors.
>
> I should be able to provide full code on request, but need to confirm
> this first.
>
> task body State_Machine_Task is
> timer_enabled : Boolean := True;
> expire_time : Duration := clock + 0.1;
> ...
> begin
> ...
> Put(Log.Debug,"----------------------------------------");
> Put(...);
> Put(timer_enabled,expire_time);
> Put(...);
>
> while Continue loop
> case SMT.DTE_State is
> when ... =>
> select
> accept ...
> ...
> or
> ...
> or
> when timer_enabled =>
> delay until expire_time;
>
> print ("In.Link_Establishment_Timeout");
>
> expire_time := clock + 0.1;
> end select;
>
> when ... =>
> ...
>
> ...
>
> end case;
> end loop;
> end;
>
>
> Generally speaking, the program does all this fine, and constantly
> prints the expired message, as required.
>
> However, occasionally something goes wrong, and while it prints the
> expiration time OK, it takes ages to print the "expired"
> message. e.g. one occasion the event was 7 hours late. This puzzles
> me, because every time the timer is incremented by 0.1 seconds, and my
> understanding is that the timer should trigger if the current time is
> greater then the expiration time.
>
> To be precise, at 1:50:57 am the timer was incremented, and the select
> reentered, and at 9:12:59 the timer expired. The actual log produced
> is below:
>
> 1:50:57 DLL DEBUG Activity_Timer: disabled
> 1:50:57 DLL DEBUG Link_Failure_Detection_Timer: disabled
> 1:50:56 DLL DEBUG In.Link_Establishment_Timeout
> 1:50:56 DLL DEBUG Out.Link_Request( 14, 1, 1)
> 1:50:56 T50 DEBUG TX Packet Packet( 22 16 2 1 14 1 1 16 3 138
9 )
> 1:50:57 DLL DEBUG Out.Link_Request return
> 1:50:57 DLL DEBUG ----------------------------------------
> 1:50:57 DLL DEBUG looping state=RESET_WAIT
> 1:50:57 DLL DEBUG Link_Establishment_Timer time 1:50:57
> 1:50:57 DLL DEBUG Retry_Timer: disabled
> 1:50:57 DLL DEBUG Acknowledgement_Timer: disabled
> 1:50:57 DLL DEBUG Activity_Timer: disabled
> 1:50:57 DLL DEBUG Link_Failure_Detection_Timer: disabled
> 9:12:59 DLL DEBUG In.Link_Establishment_Timeout
> 9:12:59 DLL DEBUG Out.Link_Request( 14, 1, 1)
> 9:12:59 T50 DEBUG TX Packet Packet( 22 16 2 1 14 1 1 16 3 138
9 )
> 9:12:59 DLL DEBUG Out.Link_Request return
> 9:12:59 DLL DEBUG ----------------------------------------
> 9:12:59 DLL DEBUG looping state=RESET_WAIT
> 9:12:59 DLL DEBUG Link_Establishment_Timer time 9:12:59
> 9:12:59 DLL DEBUG Retry_Timer: disabled
> 9:12:59 DLL DEBUG Acknowledgement_Timer: disabled
> 9:12:59 DLL DEBUG Activity_Timer: disabled
> 9:12:59 DLL DEBUG Link_Failure_Detection_Timer: disabled
>
> The fact that the time decrements from 57 seconds to 56 seconds seems
> weird in itself. It could be due to some obscure round of error in my
> code to print the time, but I can't imagine where this would occur. In
> all cases the current value of Clock is used, and it isn't stored
> anywhere. Or it could be some sort of time synchronisation tool on the
> computer, I am not aware of anything like this though.
>
> During this wait, all evidence points to the fact that the
> timer_enabled and expire_time variables are correct, they cannot be
> changed from other tasks, and that it was waiting in the select
> statement. During this time, the task appears to respond to other
> select events fine. I haven't yet tested if the timeout starts working
> again after entering the select again, as the structure of the code
> doesn't make this easy.
>
> What is going on? Strict real-time behaviour is not required, but 7
> hours instead of 0.1 seconds is slightly on the extreme side.
>
>
> Any ideas?
> Thanks in advance.
>
>
> PS. In hindsight, the "timer_enabled" variable may not be required, as
> I can use the state variable instead and probably simplify some of the
> code, but I am skeptical this is causing the problem.
> --
> Brian May <bam@snoopy.apana.org.au>
next prev parent reply other threads:[~2004-08-19 3:40 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-18 23:46 timeouts Brian May
2004-08-19 1:03 ` timeouts Jeffrey Carter
2004-08-19 3:10 ` timeouts Brian May
2004-08-19 19:18 ` timeouts Jeffrey Carter
2004-08-22 4:25 ` timeouts Brian May
2004-08-22 11:00 ` timeouts Stephen Leake
2004-08-22 11:29 ` timeouts Brian May
2004-08-22 19:56 ` timeouts Jeffrey Carter
2004-08-27 10:22 ` timeouts Brian May
2004-08-27 10:31 ` Cygwin and gcc-ada 3.4.1 (was Re: timeouts) Jano
2004-09-13 15:05 ` Dr Steve Sangwine
2004-08-27 17:54 ` timeouts Jeffrey Carter
2004-08-28 0:24 ` timeouts Stephen Leake
2004-08-29 0:24 ` timeouts Brian May
2004-08-29 4:40 ` timeouts tmoran
2004-08-29 8:57 ` timeouts Brian May
2004-08-29 17:17 ` timeouts tmoran
2004-08-29 22:37 ` timeouts Brian May
2004-08-29 13:31 ` timeouts Stephen Leake
2004-08-29 22:32 ` timeouts Brian May
2004-08-30 1:06 ` timeouts Stephen Leake
2004-08-30 12:17 ` timeouts Jano
2004-08-19 3:40 ` Steve [this message]
2004-08-22 4:18 ` timeouts Brian May
2004-08-22 12:54 ` timeouts Jeff C,
2004-08-26 1:28 ` timeouts Brian May
2004-08-26 10:00 ` timeouts Pascal Obry
2004-08-26 11:34 ` timeouts Georg Bauhaus
2004-08-26 11:58 ` timeouts Jean-Marc Bourguet
2004-08-26 22:20 ` timeouts Brian May
2004-08-27 18:12 ` timeouts Pascal Obry
2004-08-26 12:30 ` timeouts Stephen Leake
2004-08-26 22:54 ` timeouts Brian May
2004-08-27 1:17 ` timeouts Stephen Leake
2004-08-27 1:31 ` timeouts tmoran
2004-08-27 8:03 ` timeouts Brian May
2004-08-26 13:34 ` timeouts Steve
2004-08-26 14:02 ` timeouts Georg Bauhaus
2004-08-26 23:03 ` SPARK Brian May
2004-08-27 10:11 ` SPARK Georg Bauhaus
2004-08-26 23:20 ` timeouts Brian May
2004-08-27 10:20 ` timeouts Georg Bauhaus
2004-08-26 12:38 ` timeouts Jano
2004-08-26 19:07 ` timeouts Randy Brukardt
2004-08-26 21:25 ` timeouts tmoran
2004-08-26 23:01 ` timeouts Brian May
2004-08-27 0:03 ` timeouts Björn Persson
2004-08-27 9:31 ` timeouts Jano
2004-08-26 22:59 ` timeouts Brian May
2004-08-27 9:58 ` timeouts Jano
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox