From owner-freebsd-bugs Tue Jun 1 18: 0: 6 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 502B614CE2 for ; Tue, 1 Jun 1999 18:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id SAA20398; Tue, 1 Jun 1999 18:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from iss-p1.lbl.gov (iss-p1.lbl.gov [131.243.2.47]) by hub.freebsd.org (Postfix) with ESMTP id B0D4714E63 for ; Tue, 1 Jun 1999 17:57:18 -0700 (PDT) (envelope-from jin@iss-p1.lbl.gov) Received: (from jin@localhost) by iss-p1.lbl.gov (8.9.3/8.9.3) id RAA22111; Tue, 1 Jun 1999 17:57:18 -0700 (PDT) (envelope-from jin) Message-Id: <199906020057.RAA22111@iss-p1.lbl.gov> Date: Tue, 1 Jun 1999 17:57:18 -0700 (PDT) From: Jin Guojun (FTG staff) Reply-To: jin@iss-p1.lbl.gov To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/11984: pthread_kill cannot kill select() threads, etc. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 11984 >Category: kern >Synopsis: pthread_kill cannot kill select() threads, etc. >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 1 18:00:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Jin Guojun (FTG staff) >Release: FreeBSD 3.2-RELEASE i386 >Organization: >Environment: All released version with libc_r >Description: (1) missing pthread_setcanceltype() and pthread_cancel() (2) pthread_kill does not function correctly on a select() thread. See the small program in How-To-Repeat . The u_thread_* need to be replaced by simple thread/pthread calls. This version is for a universal thread programming. You may get stdef.h and from CCS library at ftp://george.lbl.gov/pub/ccs/ccs-2.1.tgz When you run the a.out, you will see all print-out. under Solaris/Linux, you will see the program terminated, but under FreeBSD, you will see a.out hanging. Use ktrace, you will see it hangs on select; however, we saw the "stest finished" which means the select() has been killed, but where is the other one from? >How-To-Repeat: /* cc -DUSE_PTHREAD pselect.c -l[c_r/pthread/etc.] */ #ifdef CCS_ECL2 #include #include #else #include #endif #include #include #ifdef linux #include #endif test(void * np) { int fd = (int) np; fd_set rfds; FD_ZERO(&rfds); FD_SET(fd, &rfds); printf("stest started\n"); select(2, &rfds, NULL, NULL, NULL); printf("stest finished\n"); u_thread_exit(0); } main() { char *fn="/tmp/stest", *fmt="can't open file %s\n"; u_thread_t tid; int fd = open(fn, O_RDONLY | O_CREAT, 0660); if (fd < 0) { #ifdef _FreeBSD_ errx(fd, fmt, fn); #else printf(fmt, fn); exit(fd); #endif } u_thread_create(&tid, 0, test, fd); sleep(2); printf("main kill %d\n", tid); u_thread_kill(tid, /* SIGKILL | SIGINT */ SIGTERM); printf("main quit\n"); u_thread_exit(0); } >Fix: Not known yet. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message