[Zope] Auto restart (at Zope's own initiative !!!)

Chris McDonough chrism@zope.com
Mon, 28 Jan 2002 19:00:04 -0500


I don't think it has anything to do with C extensions in general (Zope 
has lots of those, and for the most part, we think they work OK).  I 
think it has to do with particular C extensions that are coded 
improperly and thus cause segfaults.  A "usual suspect" in those cases 
that there would be improper memory and/or reference management.

- C

Keith J. Farmer wrote:

> For what it's worth, something I noticed under (the Win32 version of)
> Python 2.1.x is that, in a threaded environment, Python will crash if it
> an attempt to load some extensions (my case was a c-extension that
> accessed a database).
> 
> I suspect that's why Chris is asking those questions.
> 
> In particular, I noticed that while this will crash:
> 
> # AstroMathTest.py
> #
> # Tests AstroMath against Python threads
> 
> import threading
> import AstroMath
> import random
> 
> BODIES = [2,3,4,6,7,8,9,10]
> START_JD = 2448976
> N = 1000
> 
> class AstroMathTest(threading.Thread):
>     def run(self):
>         body = random.choice(BODIES)
>         end_jd = random.randrange(START_JD + 1, START_JD + 100)
>         results = AstroMath.makeQVsop(START_JD, end_jd, N, body)
>         print "Period: %s - %s\nBody: %s\nN: %s" % (START_JD, end_jd,
> body, N)
>         print "Results: %s" % str(results)
> 
> if __name__ == '__main__':
>     threads = []
>     for i in range(3):
>         thread = AstroMathTest()
>         thread.start()
>         threads.append(thread)
>     # wait for completion
>     for thread in threads:
>         thread.join()
>     print "All threads completed"
> 
> 
> ... whereas this will run successfully:
> 
> # AstroMathTest-2.py
> #
> # Tests AstroMath against Python threads
> 
> import threading
> import random
> 
> BODIES = [2,3,4,6,7,8,9,10]
> START_JD = 2448976
> N = 1000
> 
> class AstroMathTest(threading.Thread):
>     def run(self):
>         import AstroMath
>         body = random.choice(BODIES)
>         end_jd = random.randrange(START_JD + 1, START_JD + 100)
>         results = AstroMath.makeQVsop(START_JD, end_jd, N, body)
>         print "Period: %s - %s\nBody: %s\nN: %s" % (START_JD, end_jd,
> body, N)
>         print "Results: %s" % str(results)
> 
> if __name__ == '__main__':
>     threads = []
>     for i in range(3):
>         thread = AstroMathTest()
>         thread.start()
>         threads.append(thread)
>     # wait for completion
>     for thread in threads:
>         thread.join()
>     print "All threads completed"
> 
> 
> .. just by changing where the import statement lies.
> 
> Is there some way to translate this to how we should write with Zope
> external methods in mind?
> 
> ----------
> Keith J. Farmer
> kfarmer@thuban.org
> http://www.thuban.org
> 
> 
> -----Original Message-----
> From: Chris McDonough [mailto:chrism@zope.com]
> Sent: Monday, January 28, 2002 15:19
> 
> exercising no codepaths that might kick off a relational database 
> request or exercise another C extenision?
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>