Date: Tue, 1 Jun 1999 17:57:18 -0700 (PDT) From: Jin Guojun (FTG staff) <jin@iss-p1.lbl.gov> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/11984: pthread_kill cannot kill select() threads, etc. Message-ID: <199906020057.RAA22111@iss-p1.lbl.gov>
next in thread | raw e-mail | index | archive | help
>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 <uthread.h> 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 <stdef.h> #include <uthread.h> #else #include <pthread.h> #endif #include <sys/types.h> #include <fcntl.h> #ifdef linux #include <signal.h> #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906020057.RAA22111>