Hi! I have written a piece of scheduling code that executes at given times and then when the last give time is done, sleeps until the end of day, skips to the next day and re-starts the schedule… For the first time yesterday two separate command windows on Windows 10 running this scheduler froze or didn’t wake up passing from 24th of June to 25th of June… Since this happened on both separate programs running in different command windows I find it a bit suspicious… my PC did not freeze as other programs were running fine. The only way to unfreeze was to kill using Crtl+C… No major problem there but I don’t like loose suspicious ends… Could I have ‘unfrozen’ these programs in another way to continue normally? Is there something odd in my code? Is there something special about going from 24th of June to 25th of June? Screen output and relevant code below… any comments suggestions are welcome! Michael Dag Output on Screen: 2020-06-23 16:00:00 Sleeping until End of Day 2020-06-23 23:59:59 Passing End of Day on 23 jun 2020 2020-06-24 00:00:02 It's a new day on 24 jun 2020 2020-06-24 00:00:02 Sleeping until 09:00 File sent to queue XYZ on QueueManager QMXYZ 2020-06-24 09:00:00 Sleeping until 12:00 File sent to queue XYZ on QueueManager QMXYZ 2020-06-24 12:00:00 Sleeping until 16:00 File sent to queue XYZ on QueueManager QMXYZ 2020-06-24 16:00:00 Sleeping until End of Day Part that skips the end of day: EndOfDay = 23*60*60+59*60+59 Now_Timer = time_HHmmSS.format(date()) parse Now_Timer HH':'mm':'ss Now_Timer = HH*60*60+mm*60+ss If EndOfDay-Now_Timer > 0 Then Do Say date_YYYY_MM_DD.format(date()) time_HHmmSS.format(date())' Sleeping until End of Day' --\r\-' -- , 'EndOfDay-Now_Timer' Seconds \r\-' Loop While EndOfDay-Now_Timer > 0 If EndOfDay-Now_Timer > 300 Then Thread.sleep((300)*1000) /* Sleep 5 minutes */ Else Do Thread.sleep((EndOfDay-Now_Timer)*1000) /* wait for n_timer milliseconds */ End Now_Timer = time_HHmmSS.format(date()) parse Now_Timer HH':'mm':'ss Now_Timer = HH*60*60+mm*60+ss End End If EndOfDay-Now_Timer = 0 Then Do Say date_YYYY_MM_DD.format(date()) time_HHmmSS.format(date())' Passing End of Day on 'date_ddMMMYYYY.format(Date()) Thread.sleep((3)*1000) /* wait for n_timer milliseconds */ Say date_YYYY_MM_DD.format(date()) time_HHmmSS.format(date())' It''s a new day on 'date_ddMMMYYYY.format(Date()) End _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Is there something special about going
from 24th of June to 25th of June?
If it had been 30 June then Leap Seconds would
spring to mind. But since it wasn't, I'd suspect something slowed your
machine at that time so the timer overshot or undershot by 1 so your sleep
was for -1000 millisecs, which I suspect sleep() would treat as an unsigned int
and hence a very large positive number?
Mike
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Thanks! Will let it run again and see if the problem happens again… if it does I will extend the margin of 3 seconds to 5 and make EndofDay not 23:59:59 but 23:59:57 From: [hidden email] <[hidden email]> On Behalf Of Mike Cowlishaw Is there something special about going from 24th of June to 25th of June? If it had been 30 June then Leap Seconds would spring to mind. But since it wasn't, I'd suspect something slowed your machine at that time so the timer overshot or undershot by 1 so your sleep was for -1000 millisecs, which I suspect sleep() would treat as an unsigned int and hence a very large positive number? Mike _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |