From owner-freebsd-threads@FreeBSD.ORG Thu Oct 7 19:50:33 2004 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D32BD16A4E0 for ; Thu, 7 Oct 2004 19:50:33 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B453C43D5E for ; Thu, 7 Oct 2004 19:50:27 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i97JoRYX079646 for ; Thu, 7 Oct 2004 19:50:27 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i97JoR03079645; Thu, 7 Oct 2004 19:50:27 GMT (envelope-from gnats) Resent-Date: Thu, 7 Oct 2004 19:50:27 GMT Resent-Message-Id: <200410071950.i97JoR03079645@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-threads@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mark Gooderum Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A9D016A4CE for ; Thu, 7 Oct 2004 19:49:39 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3E61943D49 for ; Thu, 7 Oct 2004 19:49:39 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i97Jnd6g004042 for ; Thu, 7 Oct 2004 19:49:39 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i97Jndpw004041; Thu, 7 Oct 2004 19:49:39 GMT (envelope-from nobody) Message-Id: <200410071949.i97Jndpw004041@www.freebsd.org> Date: Thu, 7 Oct 2004 19:49:39 GMT From: Mark Gooderum To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: threads/72429: threads blocked in stdio (fgets, etc) are not cancellable in 5.3 (works in 4.x) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 19:50:34 -0000 >Number: 72429 >Category: threads >Synopsis: threads blocked in stdio (fgets, etc) are not cancellable in 5.3 (works in 4.x) >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 07 19:50:27 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Mark Gooderum >Release: 5.3 Beta 6 >Organization: Vernier Networks, Inc. >Environment: FreeBSD 172.20.1.199 5.3-BETA6 FreeBSD 5.3-BETA6 #0: Thu Oct 7 09:35:49 PDT 2004 root@eagle.jumpadmin.net:/usr/build/ambit2/freebsd5/sys/i386/compile/VNISMP i386 >Description: With libc_r in 4.9 a function blocked in stdio (say fgets()) is cancellable. The call from fgets() to the I/O in FreeBSD 4.9 with libc/libc_r: fgets() __srefill() __sread() (via fp->_read()) _read() (now in libc_r) calls thread_enter_cancellation_point() calls __read() __read() does the uthread I/O voodoo thread can be cancelled... With FreeBSD 5.3 libc/libpthread: fgets() __srefill() __sread() (via fp->_read()) _read() - weak symbol for __sys_read() in libc (libpthread only defines __read and a weak reference from read to __read) thread can't be cancelled - it's blocked in real system call and thread_enter_cancellation_point() was never called With FreeBSD 5.3 libc/libpthread: fgets() __srefill() __sread() (via fp->_read()) _read() (now in libc_r) _read() does the uthread I/O voodoo thread can't be cancelled as thread_enter_cancellation_point() was never called, that is in __read()... >How-To-Repeat: Try to pthread_cancel() a thread blocked in any stdio operation (fgets, fread, etc), it will never cancel. >Fix: Given the current conventions for _foo, __foo and foo it seems like __sread et. al. should be calling the foo() versions of the functions so they get wrapped as cancellation points. >Release-Note: >Audit-Trail: >Unformatted: