|
From: Leif M. <le...@ta...> - 2004-01-03 16:17:16
|
Grant,
Thanks for pointing this out. The Wrapper has always worked great
in an environment
where the system time is reliable but I agree that the changes you
suggest would be a
good idea. The changes are easy on the Java side, let me look into ways
of making things
work in the native code. I'll see if I can get this into the next
release. I'll post back if I
run into any problems.
Cheers,
Leif
Grant (ProtectionNET) wrote:
>Leif,
>
>Another thing, when DST comes into effect, some regions change +- by 2 hours
>so this is going to cause a problem relying on time in the wrapper code.
>
>I poked around in the wrapper.c and WrapperManager.java source and I
>absolutely think you could modify the code to include a no-time dependant
>counter.
>
>This would require you to create your own timer thread that polls every
>second and increments an unsigned long.
>
>I use this code in some of my Java apps to get a counter that continues
>forward independant of the actual system time.
>
>private long secondTimer = 0;
>
>Thread t = new Thread()
>{
> public void run()
> {
> while (true)
> {
> try
> {
> secondTimer++;
> if (secondTimer == Long.MAX_VALUE-1) secondTimer = 0;
> sleep(1000);
> }
> catch (Exception e)
> {
> }
> }
> }
>
>};
>t.start();
>
>I'm sure it wouldn't take long to develop the same code for the wrapper.c on
>Win32 and Unix ? The lack of standard threads in unix could be an issue? but
>using time the way you have will definitely cause an issue every DST
>adjustment or when the user changes the system time. They'll need to restart
>wrapper to fix this.
>
>I would continue to use a date based timer for understanding CPU load but
>ignore anything that jumps by more than 10 seconds as time adjustment above
>this is likely a time change. 10 seconds with no CPU time is a LONG time. If
>everything else moves to a CPU timer (on unix you could just count every 1/4
>second or adjust that sleep to 1 second and continue counting).
>
>When using NTP, the systems tend to drift time upwards and downwards
>gracefully so that apps don't notice the change - most hwclocks will only
>loose 1 second a day at worst so this would not really be worth worrying
>about.
>
>Grant
>
>----- Original Message -----
>From: "Leif Mortenson" <le...@ta...>
>To: <wra...@li...>
>Sent: Friday, December 26, 2003 10:33 AM
>Subject: Re: [Wrapper-user] Wrapper and Time
>
>
>
>
>>Grant,
>> :-/ That doesn't surprise me in the least that you are having
>>problems there. The
>>Wrapper makes extensive use of time both in its native and Java
>>components to keep
>>track of various timeouts. The Wrapper currently relies on the system
>>time being
>>fairly reliable.
>>
>> I could probably add some code to reset the various timeouts in the
>>event that either
>>component of the Wrapper detects that the system time appears to have
>>been changed.
>>Ie when the time decreases or is increased by a large amount.
>>
>> Small forward adjustments of the system time would be very difficult
>>to detect
>>because the Wrapper contains features to detect when the system has been
>>heavily
>>loaded. I am not sure that it would be possible to differentiate
>>between the cases where
>>the process is not given any CPU for a minute vs the clock being
>>instantly set ahead
>>by a minute.
>>
>> Could you describe how you are adjusting the time? Ie by how much,
>>in which
>>direction and why? It will help me to prioritize this. If you know
>>that the Wrapper
>>simply does not like having the clock changed, would it be unreasonable
>>to just not
>>do this? Or is changing the clock a common operation?
>>
>> I know I can make the Wrapper behave better than it is now, but am
>>unsure of how
>>perfect I can make it perform under all situations.
>>
>>Cheers,
>>Leif
>>
>>Grant (ProtectionNET) wrote:
>>
>>
>>
>>>Hi,
>>>
>>>I have a case where the Java app changes the system time (via OS calls
>>>etc) and when Wrapper is running, I have sometimes seen strange
>>>problems and the wrapper service shuts down or goes crazy when the
>>>time is changed around.
>>>
>>>I'm only starting to investigate this now, so I don't have all the
>>>facts yet.
>>>
>>>Can someone explain to me what reliance Wrapper has to time and how it
>>>uses it... that would help me track this problem down...
>>>
>>>Thanks a billion.... and merry-xmas and all that ;-)
>>>
>>>Regards,
>>>
>>>Grant
>>>
>>>
>>
>>
>>
>>-------------------------------------------------------
>>This SF.net email is sponsored by: IBM Linux Tutorials.
>>Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
>>Free Linux Tutorials. Learn everything from the bash shell to sys admin.
>>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
>>_______________________________________________
>>Wrapper-user mailing list
>>Wra...@li...
>>https://lists.sourceforge.net/lists/listinfo/wrapper-user
>>
>>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: IBM Linux Tutorials.
>Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
>Free Linux Tutorials. Learn everything from the bash shell to sys admin.
>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
>_______________________________________________
>Wrapper-user mailing list
>Wra...@li...
>https://lists.sourceforge.net/lists/listinfo/wrapper-user
>
>
>
|