deadlock when two servers call each other - will threads help?
news at dorb.com
Sun Aug 15 01:29:39 CEST 1999
There is a lot of stuff written about avoiding dead lock.
Adding threads can help, but also add more stuff that can dead lock as well
as complexity. Anything I would be able to suggest will most likely impact
your architecture. But here goes.
My favorite solution is message queues that prevent the sender from
blocking. The receiver is blocked reading the message queue. The hard part
is that the receiver is running more like a dispatcher. Messages must be
matched up with callbacks that handle that kind of message.
The handler can register for messages based on all kinds of criteria, and
This is about how Microsoft's message queues work and I suspect how the
Medusa web server works.
If you want to know more I can dig it up.
Also know as the "reactor pattern", I think ??
Skip Montanaro <skip at mojam.com> wrote in message
news:199908142158.QAA24395 at dolphin.mojam.com...
> 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.
> 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
> 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
> 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
> If so, I could spawn threads to make RPC calls between servers.
> Skip Montanaro | http://www.mojam.com/
> skip at mojam.com | http://www.musi-cal.com/~skip/
More information about the Python-list