[Ecls-list] Streams over sockets and SIGPIPE

Matthew Mondor mm_lists at pulsar-zone.net
Tue Aug 18 01:21:52 UTC 2009


Hello,

I did a small threading and sockets test today which works pretty well
and yields good performance.  It was also very nice to see that
functions can be recompiled using C-c C-c and take effect cleanly and
dynamically (i.e. SERVE in this case).  Moreover, the test shows that
no memory leaks occur (ECL gradually grows to reach 164MB SIZE and
about 30MB RES and then stays that size).

However, when stress-testing it using ab(8) (apache benchmark program),
the ECL process occasionally crashes.  Tracing it to see which signal
caused it to crash, it was SIGPIPE, which is unsurprising, my C
programs also have to install a handler for it unless using the
MSG_NOSIGNAL flag.  The SOCKET-SEND function supports such option, but
the higher level stream over socket code doesn't pass this flag.

I wonder if it'd be best to install a SIGPIPE handler or to modify the
code such that depending on configuration MSG_NOSIGNAL be used.  The
advantage of a handler would be the possibility to report a CL
END-OF-FILE condition (which SBCL appears to be doing).

Another possibility would be for my application to install a custom
signal handler for SIGPIPE.  However, I didn't see an API function in
the ECL manual to do this and didn't finish to audit the ECL signal
handling code.  If it doesn't already exist, it'd be possible to create
an interface for CL programs to do this.  Of course, cinline could be
used to install a custom SIGPIPE handler in my application, but this
would be unportable and hackish.

Any suggestions about the best route to take?

BTW, the test code is:
http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/cl/test/ecl-server2.lisp?rev=1.1;content-type=text%2Fplain
(It's written to work on ECL CVS HEAD, it depends on late SBCL
compatible changes).

Thanks,
-- 
Matt




More information about the ecl-devel mailing list