Forum OpenACS Q&A: Re: connection socket is detached

Posted by Claudio Pasolini on
Dear Gustaf,

thank you for the pointer. Actually one of the programs made use of ad_progress_bar_end (with redirect) without calling ad_script_abort: fixing it solved the problem of the detached socket.

Unfortunately the program that presents the problem more frequently can't be fixed in the same way.

The program prints one or more delivery notes. It creates one file (possibly quite large), converts it to pdf calling via exec the external binary trml2pdf (so making use of ns_proxy), sends the pdf via email to the client and finally sends the pdf to the connection via ns_writer and then aborts. In case of multiple delivery notes, before sending the pdf to the connection, the program calls another external binary (pdftk) to concatenate the various pdf produced.

Apparently there are no intermediate ns_return that can trigger the problem. Restarting Naviserver makes the problem temporary disappear and there is no easy way to reproduce the error.

I suspect a possible race condition within ns_proxy. I'll try to get some stats logging the result of 'ns_proxy stats exec_proxy' before and after the exec calls.