[Catalyst] Catalyst::Engine file handle exhaustion with C::P::JSONRPC

James R. Leu jleu at mindspring.com
Mon Nov 5 17:14:39 GMT 2007


I'd like to start by saying thank you to all Catalyst developers
and contributors for providing such a flexible and powerful
application development framework.

I realize that C::P::JSONRPC is not the best way to add JSONRPC to my
application, but at the time (6 months ago) I didn't know any better,
and it "works for me".  If the file handle exhaustion I'll mention below
is due to something that C::P::JSONRPC is doing wrong, I'll accept that
and just use the 'hack' I have in place.

I searched on the mailing list and was unable to find other posts about
this issue.  If it is a known issue or I overlooked some posts on the
mailing list, please point me in the right direction.

While running my Catalyst application under the development server provided
I've run into instances where it has run out of file descriptors and it will
stop serving up pages. 'lsof -p' of the catalyst development server shows
that it is holding onto files in the /tmp filesystem.  The contents of the
files is the JSON data for the API calls I'm making from the client back
to the server.  I've traced the origins of the files back to Catalyst::Engine
(more specifically HTTP::Body's use of File::Temp).  If I add the following
'hack' to the end of Catalyst::Engine::finalize_body the files in /tmp
get closed and I no longer experience the file handle exhaustion:

    if (defined($c->request->{_body})) {
        delete $c->request->{_body};
    }


So I have a couple of questions:
- is there a better way to 'fix' this?
- has anyone else seen this?
- what else am I breaking by adding this 'hack'?
- any prediction as to if this behavior will be the same running under
  mod_perl or FCGI?

-- 
James R. Leu
jleu at mindspring.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20071105/c7fb34b0/attachment.pgp


More information about the Catalyst mailing list