[Twisted-Python] design issue wrt exceptional events

I need a front-end to a complex of Zope systems. The front-end listens on an address/port and examines incoming http transactions, and, based upon http headers and other information, connects to one or another of the Zope systems. The underlying approach is straightforward -- a Listener waits for a http transaction, it spawns a receiver which gathers the message, decides what to do, spawns a sender to the destination. When the sender responds, the process is reversed. I currently use an adaptation of Antony Baxter's pydirector to do the job. I use his asynchat version, but have found that it leaks file descriptors in my application. I've not tried the twisted version. So I thought I'd try to craft a tailored, light-weight version using the twisted framework. I see how to manage things when everything works, but what if one or another of the endpoints fails? How do I get everything cleaned up?

On Mon, 3 Nov 2003 09:29:03 -0800 (PST) Dennis Allison <allison@shasta.stanford.edu> wrote:
I currently use an adaptation of Antony Baxter's pydirector to do the job. I use his asynchat version, but have found that it leaks file descriptors in my application. I've not tried the twisted version.
Why not use the Twisted version of pydirector? If it doesn't do exactly what you want, submit patches. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python & Twisted consulting

The twisted version does nothing much different from the asyncchat version as far as I can see. Both have comments about a race condition on closing which I suspect may be the source of my file descriptor leak. (Actually, I think it's a socket leak... ) On Mon, 3 Nov 2003, Itamar Shtull-Trauring wrote:
On Mon, 3 Nov 2003 09:29:03 -0800 (PST) Dennis Allison <allison@shasta.stanford.edu> wrote:
I currently use an adaptation of Antony Baxter's pydirector to do the job. I use his asynchat version, but have found that it leaks file descriptors in my application. I've not tried the twisted version.
Why not use the Twisted version of pydirector? If it doesn't do exactly what you want, submit patches.
-- Dennis Allison * Computer Systems Laboratory * Gates 227 * Stanford University * Stanford CA 94305 * (650) 723-9213 * (650) 723-0033 fax * allison@shasta.stanford.edu * allison@sumeru.stanford.edu

On Mon, 3 Nov 2003 10:46:22 -0800 (PST) Dennis Allison <allison@shasta.stanford.edu> wrote:
The twisted version does nothing much different from the asyncchat version as far as I can see. Both have comments about a race condition on closing which I suspect may be the source of my file descriptor leak.(Actually, I think it's a socket leak... )
Nevertheless, I'd expect it'd be easier to fix a single bug than to implement a whole program from scratch. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python & Twisted consulting
participants (2)
-
Dennis Allison
-
Itamar Shtull-Trauring