Lily Li wrote:
Hi friends,
I've encountered a serious problem when trying to port my product from win32 system to Linux.
As we need several threads running as long as zope is up running, we started the thread (tried both daemon one and non-daemon one) in the initialization of the product like (in __init__.py):
import threading
def initialize(context): ......... ......... t = threading.Thread() t.setDaemon(1) t.start()
Then zope will stop responding to any HTTP request. If the thread is not started, the zope will run correctly. Does anyone has the similar experience with it? It seems that the problem is caused by starting thread when initializing. I did threading thing before but started by HTTP request and it worked fine. Besides, this code works fine on win32 systems.
If anyone could give me any help as soon as possible, it's highly appreciated.
Let me guess: You've installed Zope as root. The problem is that Zope changes uid and gid after initializing the products. There's a bug/misfeature with Linux in that when a process changes uid/gid, any existing threads do not change with it. If you look up the list archives for problems with Xron, you'll see reports of similar problems. The solutions are to do one of the following: * If you don't need Zope to access port 80, or any privilaged port, run Zope as a non-root user. * Modify Zope to change uid/gid before initializing products. * Modify Zope to notify products with a call-back after it has changed uid/gid, so that products can do things like launch threads. * Modify Linux to fix the problem. -- Steve Alexander Software Engineer Cat-Box limited