deadlock when two servers call each other - will threads help?

Skip Montanaro skip at mojam.com
Sat Aug 14 23:58:13 CEST 1999


I'm using XML-RPC as the transport mechanism within a group of database
servers to propagate change information and thus maintain database
consistency.  My servers are logically connected in a tree structure.  Each
server has one parent (except the topmost server) and zero or more
children.  When a change request comes in to a server, if it doesn't come
from the server's parent, it forwards it there.  This allows requests to
come in anywhere in the system, then get percolated through all the servers
by forcing it to travel to the top of the tree, then trickle down.

This is fine in theory, but in practice it yields deadlocks.  A child can be
making an XML-RPC call to its parent to forward one change request at the
same time the parent is trying to make another call to that child.  Both
servers will block in read() waiting for a response that never arrives.
System throughput suffers...

I don't use threads at the moment, but I'm curious whether or not threads
would help here.  Would the blocked read() call allow another thread to run?
If so, I could spawn threads to make RPC calls between servers.

Thanks,

Skip Montanaro	| http://www.mojam.com/
skip at mojam.com  | http://www.musi-cal.com/~skip/
847-971-7098





More information about the Python-list mailing list