try except question - serious foo bar question, and pulling my hair out :-)

Steve Holden steve at holdenweb.com
Tue Feb 24 15:06:05 CET 2009


Laszlo Nagy wrote:
> 
>>>
>>> I assume stop_requested is an Event object. Maybe other thread
>>> cleared it?
>>>
>> It was never set! -> nothing can clear it.
> In theory, it could be that a thread sets the event object. E.g.:
> 
> #1. other thread calls stop_requested.set()
> #2. "while not self.stop_requested.isSet()" -- loop exists
> #3. other thread calls stop_requested.clear()
> #4. called this: self.logger.error("Feeder stopped. stop_requested =
> %s",str(self.cm.stop_requested.isSet()))
> 
> However, this cannot happen. This application is running multiple
> threads (10+) and every thread monitors the global "stop_requested"
> flag. If there was an unexpected error in the service,
> stop_requested.set() is called. It will stop all threads and exit the
> process. stop_requested.clear() is NEVER called, so the while loop
> should have not been ended. So what is happening here? It drives me crazy.
> 
Time to get a stuffed toy and go through your code, explaining to the
toy exactly why your code is right and nothing can go wrong. With luck,
within half an hour you will realize what you are doing wrong ...

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list