Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Queue get timeout parameter question

Reply
Thread Tools

Queue get timeout parameter question

 
 
Godzilla
Guest
Posts: n/a
 
      04-10-2007
Dear all,

I have been using the queue module for a multithreaded environment and
things seem to work well... until we had a requirement for the
application to be able to time sync to the server. With the time sync,
it actually disorientated the timeout in the queue's get() method...
e.g.

get(item, 2.0)

After the time sync, say 15 seconds backward, the thread is sitting on
that get() method for a total of 17 seconds. We can only sync the
device once per day and the time can drift up to 15 seconds per day!!
I had tried to get around this problem by having a sleep(2) (sleep is
not local system time dependant) just before the get(), but that will
slow down the application too much.

Anyone knows a solution to this problem or an alternative method?

 
Reply With Quote
 
 
 
 
Paul Rubin
Guest
Posts: n/a
 
      04-10-2007
"Godzilla" <(E-Mail Removed)> writes:
> After the time sync, say 15 seconds backward, the thread is sitting on
> that get() method for a total of 17 seconds. We can only sync the
> device once per day and the time can drift up to 15 seconds per day!!


Try to avoid syncing lke that. System clocks drift but the drift
rates tend to be constant, so there are schemes for gradually slowing
down or speeding up the system clock in order to keep it synchronized
with an external reference.

> Anyone knows a solution to this problem or an alternative method?


http://www.ntp.org
 
Reply With Quote
 
 
 
 
Godzilla
Guest
Posts: n/a
 
      04-10-2007
On Apr 10, 2:20 pm, Paul Rubin <http://(E-Mail Removed)> wrote:
> "Godzilla" <(E-Mail Removed)> writes:
> > After the time sync, say 15 seconds backward, the thread is sitting on
> > that get() method for a total of 17 seconds. We can only sync the
> > device once per day and the time can drift up to 15 seconds per day!!

>
> Try to avoid syncing lke that. System clocks drift but the drift
> rates tend to be constant, so there are schemes for gradually slowing
> down or speeding up the system clock in order to keep it synchronized
> with an external reference.
>
> > Anyone knows a solution to this problem or an alternative method?

>
> http://www.ntp.org


Hi Paul,

Ok... But I'm afraid no syncing is not an option for the device...

 
Reply With Quote
 
=?ISO-8859-1?Q?Thomas_Kr=FCger?=
Guest
Posts: n/a
 
      04-10-2007
Godzilla schrieb:
> I have been using the queue module for a multithreaded environment and
> things seem to work well... until we had a requirement for the
> application to be able to time sync to the server. With the time sync,
> it actually disorientated the timeout in the queue's get() method...
> e.g.
>
> get(item, 2.0)
>
> After the time sync, say 15 seconds backward, the thread is sitting on
> that get() method for a total of 17 seconds. We can only sync the
> device once per day and the time can drift up to 15 seconds per day!!
> I had tried to get around this problem by having a sleep(2) (sleep is
> not local system time dependant) just before the get(), but that will
> slow down the application too much.
>
> Anyone knows a solution to this problem or an alternative method?


I was fixing a serious time drift problem on Linux lately. If your
server runs on Linux I can give you some hints:

- set the system clock
- delete /etc/adjtime and resync system time and hardware time
"hwclock --systohc"
- on some distributions you may have to reboot
- give it some time to see if it is still drifting
- if only the system clocks drifts (see output of "hwclock; date")
you may have a timer related kernel problem. This may help:
* deactivate ACPI via kernel boot parameter
* change timer frequency
* try different setting for all timer related stuff like
CONFIG_HPET_TIMER or CONFIG_X86_PM_TIMER

Thomas

--
sinature: http://nospam.nowire.org/signature_usenet.png
 
Reply With Quote
 
Godzilla
Guest
Posts: n/a
 
      04-10-2007
On Apr 10, 5:38 pm, Thomas Krüger <(E-Mail Removed)>
wrote:
> Godzilla schrieb:
>
>
>
>
>
> > I have been using the queue module for a multithreaded environment and
> > things seem to work well... until we had a requirement for the
> > application to be able to time sync to the server. With the time sync,
> > it actually disorientated the timeout in the queue's get() method...
> > e.g.

>
> > get(item, 2.0)

>
> > After the time sync, say 15 seconds backward, the thread is sitting on
> > that get() method for a total of 17 seconds. We can only sync the
> > device once per day and the time can drift up to 15 seconds per day!!
> > I had tried to get around this problem by having a sleep(2) (sleep is
> > not local system time dependant) just before the get(), but that will
> > slow down the application too much.

>
> > Anyone knows a solution to this problem or an alternative method?

>
> I was fixing a serious time drift problem on Linux lately. If your
> server runs on Linux I can give you some hints:
>
> - set the system clock
> - delete /etc/adjtime and resync system time and hardware time
> "hwclock --systohc"
> - on some distributions you may have to reboot
> - give it some time to see if it is still drifting
> - if only the system clocks drifts (see output of "hwclock; date")
> you may have a timer related kernel problem. This may help:
> * deactivate ACPI via kernel boot parameter
> * change timer frequency
> * try different setting for all timer related stuff like
> CONFIG_HPET_TIMER or CONFIG_X86_PM_TIMER
>
> Thomas
>
> --
> sinature:http://nospam.nowire.org/signature_usenet.png- Hide quoted text -
>
> - Show quoted text -


Thanks Thomas,

I'm not running Linux but I will take some of your pointers as a
guide.

Cheers mate.

 
Reply With Quote
 
skip@pobox.com
Guest
Posts: n/a
 
      04-10-2007

Godzilla> Ok... But I'm afraid no syncing is not an option for the
Godzilla> device...

Then you'll either need to use something like ntp or sync much more
frequently so you don't yank the time by so much.

Skip
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program blocked in Queue.Queue.get and Queue.Queue.put Kris Python 0 01-04-2012 03:46 PM
Simple question about Queue.Queue and threads Frank Millman Python 3 02-09-2010 06:45 AM
multiprocessing: queue.get() blocks even if queue.qsize() != 0 redbaron Python 3 10-21-2008 08:10 AM
Is Queue.Queue.queue.clear() thread-safe? Russell Warren Python 4 06-27-2006 03:03 PM
Timeout::timeout and Socket timeout Mark Probert Ruby 1 10-06-2004 09:30 AM



Advertisments