SIGPIPE crash when writing to closed socket port

Sven Hartrumpf <[email protected]>
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
Hi all.

If a bigloo program writes to a socket port that has already been closed,
the program crashes with a SIGPIPE signal and a backtrace in gdb
like this one:

(gdb) bt
#0  0x55555430 in __kernel_vsyscall ()
#1  0x086a4a12 in __write_nocancel () at ../sysdeps/unix/syscall-template.S:81
#2  0x086da5be in bgl_syswrite ()
#3  0x086db4bd in output_flush ()
#4  0x086dbeb8 in bgl_write ()
#5  0x086e1a1c in bgl_display_string ()
#6  0x0877b3fc in bgl_display_obj ()

Protecting the code with 'with-handler' has no effect.
Linking with safe or unsafe bigloo libraries does not make a difference.

Is there a way to detect that the socket port is closed? (in the application)
Or avoid this crash in other ways? (e.g. in the bigloo runtime)

Ciao
Sven
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.