[EMAIL PROTECTED] wrote:
> Hello,
> 
>  I have noticed a interesting thing. I am trying to close my connection to
> client but I am getting weird error.

don't do that.

> 
> $r->internal_redirect("file");
> shutdown($r->connection->fileno, 1) || die "$!";

you should always return OK after calling internal_redirect(), not 
continue processing.

> ......
> ......
> do_some_internal_processing()
> .....
> .....

if you have some long process you can move it to a PerlCleanupHandler 
or something, but you're not buying yourself any advantage here at all 
- the child process isn't free to serve another request until your 
processing is complete, whether the client is connected or not.

> 
> This code always die's with error "Bad file name".
> $r->connection->fileno is always '5' for this particular case.
> 
> * CORE::shutdown, CORE::close, close, shutdown; all return same error.
> * ls -l /proc/$$/fd  turns up the socket in the listing -- but it is owned by
> root - and I am not doing any setuid.

I suspect that this is because the Apache parent process is the owner 
of it, but it's just a guess.

> Could someone please suggest to me how I should close my connection to the
> client from within mod_perl ?

don't.  just let Apache handle the TCP stuff - Apache is pretty good 
at it :)

if you're worried about performance, look into something like lingerd, 
which offers some speedups wrt the closing of the connection.

HTH

--Geoff

Reply via email to