Tcl Source Code

View Ticket
Login
Ticket UUID: 1696642
Title: sigpipes in test suite
Type: Bug Created on: 2007-04-08 23:32:21
Submitter: msofer Assigned to: jan.nijtmans
Subsystem: 25. Channel System Severity: Minor
Priority: 2 Last modified: 2026-10-26 20:52:36
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-26 20:52:36
Version: 8.6.18, 9.0.5, 9.1.0
Description:
With today's head on linux, running a --disable-shared --enable-symbols=all test under gdb (make gdb-test), there is a sigpipe in http.test. Partial backtrace attached. (Bug found by dgp)
User Comments:
msofer added on 2007-04-09 06:32:22:

File Added - 224193: backtrace.txt

dgp added on 2007-04-09 21:05:15:
Logged In: YES 
user_id=80530
Originator: NO


same issue is in the 8.5a5 release.

dgp added on 2007-04-09 21:18:50:
Logged In: YES 
user_id=80530
Originator: NO

ditto 8.5a4...

ditto 8.5a2...

dgp added on 2007-04-09 21:36:18:
Logged In: YES 
user_id=80530
Originator: NO



and older releases than that
don't have a gdb-test target,
so further testing is non-trivial.

Apparently there's some long-term
issue lurking here.

andreas_kupries added on 2007-04-10 03:33:20:
Logged In: YES 
user_id=75003
Originator: NO

Given that there is a backtrace does this mean that the core crashed ?

I thought that a SIGPIPE simply causes a Tcl error to be thrown, something which can be caught ? Although, I have seen that only for actual pipes i.e. 'tclsh ... | ...' and the sigpipe happens when the consumer exists before the tclsh, pulling the rug out under tclsh.

What does SIGPIPE means for a socket connection ? ... Ok, google (sigpipe, socket) delivers <<http://docs.hp.com/en/32650-90372/ch02s14.html>>, quoting:

    A SIGPIPE is generated when a send operation is attempted on a broken socket.
    One way of breaking a socket is to do a shutdown(,2) on a socket.

That is the same semantics as for actual pipes, so I guess that we should behave in the same wat, throw a Tcl error.

So we simply might have to catch the sigpipe and throw as tcl errors, as we do for regular pipes. ... The relevant files for that seem to be "tclUnixInit.c" and "tclUnixPipe.c", just look for 'SIGPIPE'. ... Hm. The code in UnixInit does a global SIG_IGN for this signal, to ignore it, so this should apply to sockets as well!

Which of the test cases in http.test is actually breaking ?
Could it be that gdb overrides our handling of sigpipe ?
In that case the 'crash' might simply an artifact of execution under gdb and not an actual bug.

dgp added on 2007-04-10 10:08:13:
Logged In: YES 
user_id=80530
Originator: NO


better example of the issue
is test io-29.27.  Comments
there indicate that running
such tests in a debugger will
have this problem.

Perhaps some constraints would
be useful to allow the
`make gdb-test` target to
run to completion, but seems
less likely there's any real
bug behind this.  dropping prio.

das added on 2007-04-10 19:40:20:
Logged In: YES 
user_id=90580
Originator: NO

For exactly  this reason, I have the following in my .gdbinit:
handle SIGPIPE nostop noprint
I routinely run the testsuite in gdb from Xcode, and this allows it to complete without interruptions...

dgp added on 2007-04-10 20:25:54:
Logged In: YES 
user_id=80530
Originator: NO


aha! an effective workaround.
prio lower still.

serhiy.storchaka added on 2026-10-20 13:35:22:

Still the case on main. Not a Tcl bug: Tcl ignores SIGPIPE (unix/tclUnixInit.c) and handles EPIPE, but gdb stops on the signal anyway, e.g. in io-29.27.

Proposed in branch [b0abe7aa01|gdb-ignore-sigpipe]: the gdb-test and gdb targets of unix/Makefile.in pass -ex "handle SIGPIPE nostop noprint" to gdb (the workaround from this ticket). With it, io-29.27 runs to completion under make gdb-test.


jan.nijtmans added on 2026-10-26 20:52:36:

Fixed in [4576331fff3ad26e|trunk], core-9-0-branch and core-8-6-branch

Many thanks!


Attachments: