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

Dieter Maurer dieter@handshake.de
Wed, 30 Jan 2002 01:18:51 +0100


Keith J. Farmer writes:
 > ... application crashes in threaded mode, works in non-threaded mode ...
 > If it *is* a matter of the extension itself, then an example of how it
 > should properly be done would be in order.  I've not seen any.
Threaded execution poses *much* higher requirements on application code
than non-threaded one.

Suppose, you have the following code:

	 x= malloc(...)
	 ...
	 free(x)

This is good in non-threaded code.
It can lead to desaster when "x" is accessed concurrently in different
threads, e.g. because it is a global variable or an object attribute
used in two threads.

Other desaster scenario: "Py_DECREF/Py_INCREF" concurrently in
two different threads for the same object. The result is undefined,
leading to potentially lost references and finally memory corruption.

   As a consequence: after "...AllowThreads..." you must not call
   any Python function that modifies reference counts.
   Almost all Python functions do that.

Myriads of other (not necessary Python specific) scenarios for
desaster exist...


Dieter