comp.lang.ada
 help / color / mirror / Atom feed
* delay until problem in Windows
@ 2008-04-05 22:51 george.priv
  2008-04-06 21:04 ` Jacob Sparre Andersen
  2008-04-07  3:10 ` george.priv
  0 siblings, 2 replies; 9+ messages in thread
From: george.priv @ 2008-04-05 22:51 UTC (permalink / raw)


Simplified code:

task body Some_task is

    Time_For_Next_Frame : time;

    procedure Fetch_Frame is
      -- Here is where Time_For_Next_Frame is calculated
    begin
         Send_Frame;
         Time_For_Next_Frame := Clock + Desired_Delta_T;
    end Fetch_Frame;

begin

   loop

      select
          ...
      or
         delay until Time_For_Next_Frame;

         Fetch_Frame;

   end loop;

end Some_Task;

Symptoms:

After over 24+ hour operations it seems that delay gives no delay no
matter what value there is on Windows system .  On Linux all is fine.

If I replace delay statement with

delay Desired_Delta_T;

all seemed fine.  Does anyone knows of that limitation?

George.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-05 22:51 delay until problem in Windows george.priv
@ 2008-04-06 21:04 ` Jacob Sparre Andersen
  2008-04-07  3:32   ` george.priv
  2008-04-07  3:10 ` george.priv
  1 sibling, 1 reply; 9+ messages in thread
From: Jacob Sparre Andersen @ 2008-04-06 21:04 UTC (permalink / raw)


george.priv@gmail.com writes:

>    loop
>
>       select
>           ...
>       or
>          delay until Time_For_Next_Frame;
>
>          Fetch_Frame;
>
>    end loop;

> After over 24+ hour operations it seems that delay gives no delay no
> matter what value there is on Windows system

You might want to report this to your compiler vendor.  It definitely
sounds like an error in the compiler/run-time system to me.

Greetings,

Jacob
-- 
�And what about homo sapiens?
 Yes, we think that would be a very good idea ...� -- not Gandhi



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-05 22:51 delay until problem in Windows george.priv
  2008-04-06 21:04 ` Jacob Sparre Andersen
@ 2008-04-07  3:10 ` george.priv
  2008-04-07  7:25   ` Dmitry A. Kazakov
  1 sibling, 1 reply; 9+ messages in thread
From: george.priv @ 2008-04-07  3:10 UTC (permalink / raw)


On Apr 5, 6:51 pm, george.p...@gmail.com wrote:


Little update on the issue.  The following program was created to
reproduce the problem:

with Ada.Calendar;
use Ada.Calendar;
with Ada.Text_IO;
use Ada.Text_IO;

with Ada.Calendar.Formatting;
use Ada.Calendar.Formatting;

procedure Delay_Test is

   Start_Time  : Time := Clock;
   Time_Failed : Time := Start_Time; -- Time of first failure
encountered

   task Delay_Test_Tsk is
      entry Term;
   end Delay_Test_Tsk;

   task body Delay_Test_Tsk is

      DT            : constant Duration := 10.0;       -- Desired
Delta T
      Time_For_Next :          Time     := Clock + DT; -- Next cycle
      Last          :          Time     := Clock;      -- Last cycle
clocked
      Fail_Count    :          Natural  := 0;

   begin

      while Fail_Count < 5 loop

         select
            accept Term;
            exit;
         or
            delay until Time_For_Next;
            declare
               Actual_Delta : Duration := Clock - Last;
            begin

               Last := Clock;
               Time_For_Next := Last + DT;

               Put_Line("Actual Delay: " &
Duration'Image(Actual_Delta)
                  & ", Running (h):"
                  & Duration'Image((Clock - Start_Time)/3600.0));
               if Actual_Delta < DT then
                  if Fail_Count = 0 then
                     Time_Failed := Clock;
                  end if;
                  Fail_Count := Fail_Count + 1;
               else
                  Fail_Count := 0;
               end if;
            end;

         end select;

      end loop;

      Put_Line("Started at:" & Image(Start_Time));

      if Time_Failed /= Start_Time then
         Put_Line("Failed at :" & Image(Time_Failed));
         Put_Line("Failed after  :" & Duration'Image(Time_Failed -
Start_Time));
      end if;

   end Delay_Test_Tsk;

   Line : String (1 .. 80);
   Last : Natural;

begin
   loop
      Get_Line(Line, Last);
      exit when Line(1) = 'q' or Line(1) = 'Q';
   end loop;
   Delay_Test_Tsk.Term;
end Delay_Test;




Results vary from Windows flavors and I am not sure also that it is
not related to a particular hardware.  So far it is fine on Vista
(after 22 hours) and XP (10 Hours).  It failed on Server 2003 after 12
hours see output:

Actual Delay:  10.000372615, Running (h): 11.836564300
Actual Delay:  10.000381345, Running (h): 11.839342185
Actual Delay:  10.000370677, Running (h): 11.842120066
Actual Delay:  10.000379534, Running (h): 11.844897949
Actual Delay:  10.000372998, Running (h): 11.847675831
Actual Delay:  10.000545537, Running (h): 11.850453761
Actual Delay:  7.984454967, Running (h): 11.852675966
Actual Delay:  7.984806621, Running (h): 11.854893969
Actual Delay:  7.984636928, Running (h): 11.857111924
Actual Delay:  7.984678819, Running (h): 11.859329891
Actual Delay:  7.984673656, Running (h): 11.861547856
Started at:2008-04-06 07:14:09
Failed at :2008-04-06 19:05:18
Failed after  : 42669.633539129


If anyone would like to check their systems and let us know?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-06 21:04 ` Jacob Sparre Andersen
@ 2008-04-07  3:32   ` george.priv
  0 siblings, 0 replies; 9+ messages in thread
From: george.priv @ 2008-04-07  3:32 UTC (permalink / raw)


On Apr 6, 5:04 pm, Jacob Sparre Andersen <spa...@nbi.dk> wrote:
> george.p...@gmail.com writes:
> >    loop
>
> >       select
> >           ...
> >       or
> >          delay until Time_For_Next_Frame;
>
> >          Fetch_Frame;
>
> >    end loop;
> > After over 24+ hour operations it seems that delay gives no delay no
> > matter what value there is on Windows system
>
> You might want to report this to your compiler vendor.  It definitely
> sounds like an error in the compiler/run-time system to me.
>
> Greetings,
>
> Jacob
> --
> »And what about homo sapiens?
>  Yes, we think that would be a very good idea ...« -- not Gandhi

I will once have more results (see other post).



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-07  3:10 ` george.priv
@ 2008-04-07  7:25   ` Dmitry A. Kazakov
  2008-04-07 14:43     ` george.priv
  2008-04-09 14:56     ` george.priv
  0 siblings, 2 replies; 9+ messages in thread
From: Dmitry A. Kazakov @ 2008-04-07  7:25 UTC (permalink / raw)


On Sun, 6 Apr 2008 20:10:38 -0700 (PDT), george.priv@gmail.com wrote:

> On Apr 5, 6:51 pm, george.p...@gmail.com wrote:

[...]

> with Ada.Calendar;
> use Ada.Calendar;

I don't know the implementation of, but Ada.Calendar is a political time,
influenced by the time synchronization stuff. What happens if you replace
it by Ada.Real_Time?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-07  7:25   ` Dmitry A. Kazakov
@ 2008-04-07 14:43     ` george.priv
  2008-04-07 14:51       ` george.priv
  2008-04-09 14:56     ` george.priv
  1 sibling, 1 reply; 9+ messages in thread
From: george.priv @ 2008-04-07 14:43 UTC (permalink / raw)


On Apr 7, 3:25 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Sun, 6 Apr 2008 20:10:38 -0700 (PDT), george.p...@gmail.com wrote:
> > On Apr 5, 6:51 pm, george.p...@gmail.com wrote:
>
> [...]
>
> > with Ada.Calendar;
> > use Ada.Calendar;
>
> I don't know the implementation of, but Ada.Calendar is a political time,
> influenced by the time synchronization stuff. What happens if you replace
> it by Ada.Real_Time?
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

It may worth trying and I will set this up running at first
opportunity, but I think since it is a particular computer system/OS
combination it should eliminate "political" issue since all systems
are in one time zone and all synced from the same time server.  So far
I saw that happening only on one system with Server 2003.  Similar
hardware running Debian is doing fine.  Other machines running Windows
XP and Vista (Notebook) went for 32 hours now and doing fine.  All
workstations at my place are the same - that limits my sample pool.  I
also do repeat run on failed machine to see if there will be
consistency in times.

Regards,

George Privalov




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-07 14:43     ` george.priv
@ 2008-04-07 14:51       ` george.priv
  2008-04-08 11:02         ` Alex R. Mosteo
  0 siblings, 1 reply; 9+ messages in thread
From: george.priv @ 2008-04-07 14:51 UTC (permalink / raw)


On Apr 7, 10:43 am, george.p...@gmail.com wrote:
> On Apr 7, 3:25 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>
> > On Sun, 6 Apr 2008 20:10:38 -0700 (PDT), george.p...@gmail.com wrote:
> > > On Apr 5, 6:51 pm, george.p...@gmail.com wrote:
>
> > [...]
>
> > > with Ada.Calendar;
> > > use Ada.Calendar;
>
> > I don't know the implementation of, but Ada.Calendar is a political time,
> > influenced by the time synchronization stuff. What happens if you replace
> > it by Ada.Real_Time?
>
> > --
> > Regards,
> > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
>
> It may worth trying and I will set this up running at first
> opportunity, but I think since it is a particular computer system/OS
> combination it should eliminate "political" issue since all systems
> are in one time zone and all synced from the same time server.  So far
> I saw that happening only on one system with Server 2003.  Similar
> hardware running Debian is doing fine.  Other machines running Windows
> XP and Vista (Notebook) went for 32 hours now and doing fine.  All
> workstations at my place are the same - that limits my sample pool.  I
> also do repeat run on failed machine to see if there will be
> consistency in times.
>
> Regards,
>
> George Privalov

As soon as I posted that message, my XP workstation failed. But time
is now off forward 2 seconds after 30.5 hours. So drama is not over
yet.

Actual Delay:  10.000123715, Running (h): 30.430967673
Actual Delay:  10.000125595, Running (h): 30.433745487
Actual Delay:  10.000125257, Running (h): 30.436523299
Actual Delay:  10.000124860, Running (h): 30.439301112
Actual Delay:  10.000124743, Running (h): 30.442078925
Actual Delay:  12.000310334, Running (h): 30.445412345
Actual Delay:  12.000189837, Running (h): 30.448745732
Actual Delay:  12.000190605, Running (h): 30.452079118
Actual Delay:  12.000190805, Running (h): 30.455412505
Actual Delay:  12.000191032, Running (h): 30.458745892
Actual Delay:  12.000189268, Running (h): 30.462079278
Actual Delay:  12.000190642, Running (h): 30.465412665
Actual Delay:  12.000190666, Running (h): 30.468746051
Actual Delay:  12.000190224, Running (h): 30.472079438
Actual Delay:  12.000190730, Running (h): 30.475412825

George



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-07 14:51       ` george.priv
@ 2008-04-08 11:02         ` Alex R. Mosteo
  0 siblings, 0 replies; 9+ messages in thread
From: Alex R. Mosteo @ 2008-04-08 11:02 UTC (permalink / raw)


george.priv@gmail.com wrote:

> On Apr 7, 10:43 am, george.p...@gmail.com wrote:
>> On Apr 7, 3:25 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
>> wrote:
>>
>> > On Sun, 6 Apr 2008 20:10:38 -0700 (PDT), george.p...@gmail.com wrote:
>> > > On Apr 5, 6:51 pm, george.p...@gmail.com wrote:
>>
>> > [...]
>>
>> > > with Ada.Calendar;
>> > > use Ada.Calendar;
>>
>> > I don't know the implementation of, but Ada.Calendar is a political time,
>> > influenced by the time synchronization stuff. What happens if you replace
>> > it by Ada.Real_Time?
>>
>> > --
>> > Regards,
>> > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
>>
>> It may worth trying and I will set this up running at first
>> opportunity, but I think since it is a particular computer system/OS
>> combination it should eliminate "political" issue since all systems
>> are in one time zone and all synced from the same time server.  So far
>> I saw that happening only on one system with Server 2003.  Similar
>> hardware running Debian is doing fine.  Other machines running Windows
>> XP and Vista (Notebook) went for 32 hours now and doing fine.  All
>> workstations at my place are the same - that limits my sample pool.  I
>> also do repeat run on failed machine to see if there will be
>> consistency in times.
>>
>> Regards,
>>
>> George Privalov
> 
> As soon as I posted that message, my XP workstation failed. But time
> is now off forward 2 seconds after 30.5 hours. So drama is not over
> yet.
> 
> Actual Delay:  10.000123715, Running (h): 30.430967673
> Actual Delay:  10.000125595, Running (h): 30.433745487
> Actual Delay:  10.000125257, Running (h): 30.436523299
> Actual Delay:  10.000124860, Running (h): 30.439301112
> Actual Delay:  10.000124743, Running (h): 30.442078925
> Actual Delay:  12.000310334, Running (h): 30.445412345
> Actual Delay:  12.000189837, Running (h): 30.448745732
> Actual Delay:  12.000190605, Running (h): 30.452079118
> Actual Delay:  12.000190805, Running (h): 30.455412505
> Actual Delay:  12.000191032, Running (h): 30.458745892
> Actual Delay:  12.000189268, Running (h): 30.462079278
> Actual Delay:  12.000190642, Running (h): 30.465412665
> Actual Delay:  12.000190666, Running (h): 30.468746051
> Actual Delay:  12.000190224, Running (h): 30.472079438
> Actual Delay:  12.000190730, Running (h): 30.475412825
> 
> George

I remember some delay-related bug in the windows version of 3.15p. In my code
it manifested as tasks blocking for unexpectedly long times (usually hours
instead of milliseconds). I thought it had been fixed long ago, and certainly
your symptoms are different.

However, in case it has any relation, here's one (it seems it's partial, google
lost track) thread dealing with it. There may be more, and there was a patch
somewhere.

http://groups.google.com/group/comp.lang.ada/browse_frm/thread/5e062f5bcdb88fd8/94576cccaf04d9de?tvc=1&q=mosteo+bug#94576cccaf04d9de



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: delay until problem in Windows
  2008-04-07  7:25   ` Dmitry A. Kazakov
  2008-04-07 14:43     ` george.priv
@ 2008-04-09 14:56     ` george.priv
  1 sibling, 0 replies; 9+ messages in thread
From: george.priv @ 2008-04-09 14:56 UTC (permalink / raw)


On Apr 7, 3:25 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Sun, 6 Apr 2008 20:10:38 -0700 (PDT), george.p...@gmail.com wrote:
> > On Apr 5, 6:51 pm, george.p...@gmail.com wrote:
>
> [...]
>
> > with Ada.Calendar;
> > use Ada.Calendar;
>
> I don't know the implementation of, but Ada.Calendar is a political time,
> influenced by the time synchronization stuff. What happens if you replace
> it by Ada.Real_Time?
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

You were right: so far the Real_Time version is running for 48 hours
without failing.  So that may be a workaround.

with Ada.Real_Time;
use Ada.Real_Time;
with Ada.Text_IO;
use Ada.Text_IO;

--with Ada.RealFormatting;
with Ada.Calendar.Formatting;

procedure Delay_RT is

   Start_Time  : Time              := Clock;
   Time_Failed : Time              := Start_Time;
   ST          : Ada.Calendar.Time := Ada.Calendar.Clock;
   FT          : Ada.Calendar.Time := ST;

   task Delay_Test_Tsk is
      entry Term;
   end Delay_Test_Tsk;

   task body Delay_Test_Tsk is

      DT            : constant Time_Span := Seconds (10); -- Desired
Delta T
      Time_For_Next :          Time      := Clock + DT;   -- Next
cycle
      Last          :          Time      := Clock;        -- Last
cycle clocked
      Fail_Count    :          Natural   := 0;

   begin

      while Fail_Count < 5 loop

         select
            accept Term;
            exit;
         or
            delay until Time_For_Next;
            declare
               Actual_Delta : Time_Span := Clock - Last;
            begin

               Last := Clock;
               Time_For_Next := Last + DT;

               Put_Line("Actual Delay: " & Duration'Image(To_Duration(
                        Actual_Delta))
                  & ", Running (h):"
                  & Duration'Image(To_Duration(Clock - Start_Time)/
3600.0));
               if Actual_Delta < DT or Actual_Delta > (DT +
Seconds(1)) then
                  if Fail_Count = 0 then
                     Time_Failed := Clock;
                     FT := Ada.Calendar.Clock;
                  end if;
                  Fail_Count := Fail_Count + 1;
               else
                  Fail_Count := 0;
               end if;
            end;

         end select;

      end loop;

      Put_Line("Started at:" & Ada.Calendar.Formatting.Image(ST));

      if Time_Failed /= Start_Time then
         Put_Line("Failed at :" & Ada.Calendar.Formatting.Image(FT));
         Put_Line("Failed after  :" & Duration'Image(To_Duration(
                  Time_Failed -
                  Start_Time)));
      end if;

   end Delay_Test_Tsk;

   Line : String (1 .. 80);
   Last : Natural;

begin
   loop
      Get_Line(Line, Last);
      exit when Line(1) = 'q' or Line(1) = 'Q';
   end loop;
   Delay_Test_Tsk.Term;
end Delay_RT;





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-04-09 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-05 22:51 delay until problem in Windows george.priv
2008-04-06 21:04 ` Jacob Sparre Andersen
2008-04-07  3:32   ` george.priv
2008-04-07  3:10 ` george.priv
2008-04-07  7:25   ` Dmitry A. Kazakov
2008-04-07 14:43     ` george.priv
2008-04-07 14:51       ` george.priv
2008-04-08 11:02         ` Alex R. Mosteo
2008-04-09 14:56     ` george.priv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox