From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 4 16:20:09 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F1741065676 for ; Mon, 4 Jul 2011 16:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 36B578FC14 for ; Mon, 4 Jul 2011 16:20:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p64GK9Bc028304 for ; Mon, 4 Jul 2011 16:20:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p64GK9Ew028303; Mon, 4 Jul 2011 16:20:09 GMT (envelope-from gnats) Resent-Date: Mon, 4 Jul 2011 16:20:09 GMT Resent-Message-Id: <201107041620.p64GK9Ew028303@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tom Hukins Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EAEB106566B for ; Mon, 4 Jul 2011 16:11:15 +0000 (UTC) (envelope-from tom@muscovy.scrubhole.org) Received: from muscovy.scrubhole.org (muscovy.scrubhole.org [62.3.122.99]) by mx1.freebsd.org (Postfix) with ESMTP id 2562D8FC19 for ; Mon, 4 Jul 2011 16:11:14 +0000 (UTC) Received: from muscovy.scrubhole.org (localhost [127.0.0.1]) by muscovy.scrubhole.org (8.14.4/8.14.4) with ESMTP id p64FeA0E073198 for ; Mon, 4 Jul 2011 15:40:10 GMT (envelope-from tom@muscovy.scrubhole.org) Received: (from tom@localhost) by muscovy.scrubhole.org (8.14.4/8.14.4/Submit) id p64FeAYs073197; Mon, 4 Jul 2011 15:40:10 GMT (envelope-from tom) Message-Id: <201107041540.p64FeAYs073197@muscovy.scrubhole.org> Date: Mon, 4 Jul 2011 15:40:10 GMT From: Tom Hukins To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/158641: Writing > 8192 bytes to a pipe blocks signal handling X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Tom Hukins List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2011 16:20:09 -0000 >Number: 158641 >Category: kern >Synopsis: Writing > 8192 bytes to a pipe blocks signal handling >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 04 16:20:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Tom Hukins >Release: FreeBSD 8.2-RELEASE-p2 i386 >Organization: >Environment: System: FreeBSD muscovy.scrubhole.org 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Wed Jun 15 14:20:45 UTC 2011 root@muscovy.scrubhole.org:/home/obj/home/src/RELENG_8_2_2011-06-15/sys/GENERIC i386 >Description: When a pipe has more than 8192 bytes written to it, the current process hangs and does not handle signals correctly. >How-To-Repeat: #include #include #include #include #include #include #define BUFFER_LENGTH 16384 void catch_alrm(int sig_num) { printf("Alarm received\n"); fflush(stdout); } int main (int argc, char **argv) { char buff_read[BUFFER_LENGTH]; int pdes[2]; if ( pipe(pdes) != 0) { return 1; } signal(SIGALRM, catch_alrm); int mypid = getpid(); write( pdes[1], argv[1], strlen(argv[1]) ); kill(mypid, SIGALRM); return 0; } /* Save the above as "pipefreeze.c", then run: % cc -g -Wall pipefreeze.c && ./a.out HELLO % perl -e 'print q(x) x 8192' | xargs ./a.out & The first input of < 8192 bytes works fine, the second does not. Sending "kill -ALRM PID" to the second process in the second example terminates the process, but does not call the signal handler. */ >Fix: >Release-Note: >Audit-Trail: >Unformatted: