From owner-freebsd-threads@FreeBSD.ORG Mon Nov 30 11:07:03 2009 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 314641065697 for ; Mon, 30 Nov 2009 11:07:03 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 14C5B8FC2A for ; Mon, 30 Nov 2009 11:07:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAUB72Z5043574 for ; Mon, 30 Nov 2009 11:07:02 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nAUB72Me043570 for freebsd-threads@FreeBSD.org; Mon, 30 Nov 2009 11:07:02 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 30 Nov 2009 11:07:02 GMT Message-Id: <200911301107.nAUB72Me043570@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2009 11:07:03 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o threa/136345 threads Recursive read rwlocks in thread A cause deadlock with o threa/135673 threads databases/mysql50-server - MySQL query lock-ups on 7.2 p threa/135462 threads [PATCH] _thread_cleanupspecific() doesn't handle delet o threa/133734 threads 32 bit libthr failing pthread_create() o threa/128922 threads threads hang with xorg running o threa/127225 threads bug in lib/libthr/thread/thr_init.c o threa/122923 threads 'nice' does not prevent background process from steali o threa/121336 threads lang/neko threading ok on UP, broken on SMP (FreeBSD 7 o threa/118715 threads kse problem o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP o threa/116181 threads /dev/io-related io access permissions are not propagat o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/101323 threads [patch] fork(2) in threaded programs broken. s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/83914 threads [libc] popen() doesn't work in static threaded program o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/80435 threads panic on high loads o threa/79887 threads [patch] freopen() isn't thread-safe o threa/79683 threads svctcp_create() fails if multiple threads call at the s threa/76694 threads fork cause hang in dup()/close() function in child (-l s threa/76690 threads fork hang in child for -lc_r o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/70975 threads [sysvipc] unexpected and unreliable behaviour when usi s threa/69020 threads pthreads library leaks _gc_mutex s threa/49087 threads Signals lost in programs linked with libc_r s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/34536 threads accept() blocks other threads s threa/32295 threads [libc_r] [patch] pthread(3) dont dequeue signals s threa/30464 threads pthread mutex attributes -- pshared s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o 41 problems total. From owner-freebsd-threads@FreeBSD.ORG Tue Dec 1 18:40:02 2009 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3928E106568F for ; Tue, 1 Dec 2009 18:40:02 +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 F0FE38FC19 for ; Tue, 1 Dec 2009 18:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1Ie1ag018248 for ; Tue, 1 Dec 2009 18:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nB1Ie1Gq018247; Tue, 1 Dec 2009 18:40:01 GMT (envelope-from gnats) Resent-Date: Tue, 1 Dec 2009 18:40:01 GMT Resent-Message-Id: <200912011840.nB1Ie1Gq018247@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, wijlbewt Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 183781065693 for ; Tue, 1 Dec 2009 18:31:37 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E27658FC17 for ; Tue, 1 Dec 2009 18:31:36 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1IValM085498 for ; Tue, 1 Dec 2009 18:31:36 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nB1IVa5j085497; Tue, 1 Dec 2009 18:31:36 GMT (envelope-from nobody) Message-Id: <200912011831.nB1IVa5j085497@www.freebsd.org> Date: Tue, 1 Dec 2009 18:31:36 GMT From: wijlbewt To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: threads/141062: wijlbewt X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 18:40:02 -0000 >Number: 141062 >Category: threads >Synopsis: wijlbewt >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 01 18:40:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: wijlbewt >Release: wijlbewt >Organization: wijlbewt >Environment: wijlbewt >Description: [URL=http://kaulsjhz.com]xcbnyrox[/URL] uhwpnrsy qkaajlab http://dhgckxlu.com tpzoscmf ijbgoyzc >How-To-Repeat: wijlbewt >Fix: wijlbewt >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-threads@FreeBSD.ORG Tue Dec 1 18:40:05 2009 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1117E10656A5 for ; Tue, 1 Dec 2009 18:40:05 +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 C9A808FC1A for ; Tue, 1 Dec 2009 18:40:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1Ie4nm018388 for ; Tue, 1 Dec 2009 18:40:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nB1Ie4qF018387; Tue, 1 Dec 2009 18:40:04 GMT (envelope-from gnats) Resent-Date: Tue, 1 Dec 2009 18:40:04 GMT Resent-Message-Id: <200912011840.nB1Ie4qF018387@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, drvrouph Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D3F0106568B for ; Tue, 1 Dec 2009 18:35:43 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 739448FC17 for ; Tue, 1 Dec 2009 18:35:43 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1IZhVN090056 for ; Tue, 1 Dec 2009 18:35:43 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nB1IZg21090054; Tue, 1 Dec 2009 18:35:43 GMT (envelope-from nobody) Message-Id: <200912011835.nB1IZg21090054@www.freebsd.org> Date: Tue, 1 Dec 2009 18:35:43 GMT From: drvrouph To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: threads/141071: drvrouph X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 18:40:05 -0000 >Number: 141071 >Category: threads >Synopsis: drvrouph >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Dec 01 18:40:04 UTC 2009 >Closed-Date: >Last-Modified: >Originator: drvrouph >Release: drvrouph >Organization: drvrouph >Environment: drvrouph >Description: qednihrj http://bpoikifz.com opipimca rtsgnyou >How-To-Repeat: drvrouph >Fix: drvrouph >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-threads@FreeBSD.ORG Tue Dec 1 20:05:13 2009 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97A851065670; Tue, 1 Dec 2009 20:05:13 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6EED48FC1B; Tue, 1 Dec 2009 20:05:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1K5DQl095259; Tue, 1 Dec 2009 20:05:13 GMT (envelope-from linimon@freefall.freebsd.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nB1K5DXH095255; Tue, 1 Dec 2009 20:05:13 GMT (envelope-from linimon) Date: Tue, 1 Dec 2009 20:05:13 GMT Message-Id: <200912012005.nB1K5DXH095255@freefall.freebsd.org> To: hftbvffv@qxvuqgua.com, linimon@FreeBSD.org, freebsd-threads@FreeBSD.org, gnats-adm@FreeBSD.org From: linimon@FreeBSD.org Cc: Subject: Re: junk/141062: wijlbewt X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 20:05:13 -0000 Synopsis: wijlbewt State-Changed-From-To: open->closed State-Changed-By: linimon State-Changed-When: Tue Dec 1 20:04:24 UTC 2009 State-Changed-Why: spam Responsible-Changed-From-To: freebsd-threads->gnats-adm Responsible-Changed-By: linimon Responsible-Changed-When: Tue Dec 1 20:04:24 UTC 2009 Responsible-Changed-Why: http://www.freebsd.org/cgi/query-pr.cgi?pr=141062 From owner-freebsd-threads@FreeBSD.ORG Tue Dec 1 20:08:43 2009 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 302951065672; Tue, 1 Dec 2009 20:08:43 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0803F8FC13; Tue, 1 Dec 2009 20:08:43 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nB1K8gHG095643; Tue, 1 Dec 2009 20:08:42 GMT (envelope-from linimon@freefall.freebsd.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nB1K8gfU095639; Tue, 1 Dec 2009 20:08:42 GMT (envelope-from linimon) Date: Tue, 1 Dec 2009 20:08:42 GMT Message-Id: <200912012008.nB1K8gfU095639@freefall.freebsd.org> To: yerrpzlq@bojfpylx.com, linimon@FreeBSD.org, freebsd-threads@FreeBSD.org From: linimon@FreeBSD.org Cc: Subject: Re: junk/141071: drvrouph X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 20:08:43 -0000 Synopsis: drvrouph State-Changed-From-To: open->closed State-Changed-By: linimon State-Changed-When: Tue Dec 1 20:08:08 UTC 2009 State-Changed-Why: spam http://www.freebsd.org/cgi/query-pr.cgi?pr=141071 From owner-freebsd-threads@FreeBSD.ORG Wed Dec 2 17:14:06 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C68D1065670 for ; Wed, 2 Dec 2009 17:14:06 +0000 (UTC) (envelope-from gprspb@mail.ru) Received: from mailgw.nnz-home.ru (mailgw.nnz-home.ru [87.249.56.38]) by mx1.freebsd.org (Postfix) with ESMTP id 9EF578FC0A for ; Wed, 2 Dec 2009 17:14:05 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by mailgw.nnz-home.ru (Postfix) with ESMTP id 78185284AC for ; Wed, 2 Dec 2009 19:57:47 +0300 (MSK) X-Virus-Scanned: amavisd-new at mailgw.nnz-home.ru Received: from mailgw.nnz-home.ru ([127.0.0.1]) by localhost (mailgw.nnz-home.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X8Lc+oK6y3lR for ; Wed, 2 Dec 2009 19:57:47 +0300 (MSK) Received: from gpr.nnz-home.ru (unknown [10.44.111.151]) by mailgw.nnz-home.ru (Postfix) with ESMTP id 3544D28456 for ; Wed, 2 Dec 2009 19:57:47 +0300 (MSK) Received: from gpr by gpr.nnz-home.ru with local (Exim 4.69) (envelope-from ) id 1NFsVT-0000Vb-Jb for freebsd-threads@freebsd.org; Wed, 02 Dec 2009 19:56:47 +0300 Date: Wed, 2 Dec 2009 19:56:47 +0300 From: Gennady Proskurin To: freebsd-threads@freebsd.org Message-ID: <20091202165647.GA1944@gpr.nnz-home.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Subject: pipe with threads X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 17:14:06 -0000 --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I use usual scenario for writing data to stdin of some other program: 1. pipe, fork 2. Child: dup2, exec. Parent: write When my program is single-threaded (or may be multithreaded, with only one thread running this scenario), all works fine. But when this scenario executed concurently by many threads, the reading process sometimes doesn't see, that pipe was closed and reading process is stuck in read() (piperd wchan), and write process is stuck in waitpid. Is it a bug somewhere or I missing something? Test program attached. I compile it with "cc -o pipetest pipetest.c -pthread" And run: "while [ 1 ]; do ./pipetest ; done" My system: fresh 9-currend/amd64, smp (2 CPU) --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pipetest.c" #include #include #include #include #include static char data[10]; void* thr_func(void* arg) { int pipe_fd[2]; int pid; const char* buf = data; int write_remain = sizeof(data); int waitpid_status; int waitpid_res; int bar_res; if (pipe(pipe_fd)<0) { perror("pipe()"); _exit(1); } printf("fd: %i %i\n", pipe_fd[0], pipe_fd[1]); pid = fork(); switch(pid) { case -1: perror("fork()"); _exit(1); case 0: if (close(pipe_fd[1])) { perror("close()"); _exit(1); } if (dup2(pipe_fd[0], STDIN_FILENO) == -1) { perror("dup2()"); _exit(1); } execl("/bin/sh", "sh", "-c", "cat > /dev/null", 0); perror("exec()"); _exit(1); } if (close(pipe_fd[0])) { perror("close()"); _exit(1); } // write data while (write_remain>0) { int w = write(pipe_fd[1], buf, write_remain); if (w>0) { buf += w; write_remain -= w; printf("write:%i\n", w); } else { perror("write()"); _exit(1); } } if (close(pipe_fd[1])) { perror("close()"); _exit(1); } // wait child waitpid_res = waitpid(pid, &waitpid_status, 0); if (waitpid_res != pid) { perror("waitpid()"); _exit(1); } return 0; } int main() { pthread_t thr1, thr2; sigset_t mask; // block SIGCHLD sigemptyset(&mask); sigaddset(&mask, SIGCHLD); if (sigprocmask(SIG_BLOCK, &mask, 0)) { perror("sigprocmask()"); _exit(1); } // create threads if (pthread_create(&thr1,0,thr_func,0) || pthread_create(&thr2,0,thr_func,0)) { perror("pthread_create()"); _exit(1); } // join threads if (pthread_join(thr1,0) || pthread_join(thr2,0)) { perror("pthread_join()"); _exit(1); } printf("OK\n"); return 0; } --h31gzZEtNLTqOjlF-- From owner-freebsd-threads@FreeBSD.ORG Wed Dec 2 17:48:01 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEC9A106566B for ; Wed, 2 Dec 2009 17:48:01 +0000 (UTC) (envelope-from jp@devnull.cz) Received: from smtp2.vol.cz (smtp2.vol.cz [195.250.128.75]) by mx1.freebsd.org (Postfix) with ESMTP id 9E0E18FC17 for ; Wed, 2 Dec 2009 17:48:01 +0000 (UTC) Received: from 167.col.prg.mynet.cz (167.col.prg.mynet.cz [195.122.208.167]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.volny.cz (Postfix) with ESMTPS id 803EE289E7; Wed, 2 Dec 2009 18:30:38 +0100 (CET) Date: Wed, 2 Dec 2009 18:28:11 +0100 (CET) From: Jan Pechanec X-X-Sender: janp@rax.devnull.cz To: Gennady Proskurin In-Reply-To: <20091202165647.GA1944@gpr.nnz-home.ru> Message-ID: References: <20091202165647.GA1944@gpr.nnz-home.ru> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-threads@freebsd.org Subject: Re: pipe with threads X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2009 17:48:01 -0000 On Wed, 2 Dec 2009, Gennady Proskurin wrote: >I use usual scenario for writing data to stdin of some other program: >1. pipe, fork >2. Child: dup2, exec. Parent: write > >When my program is single-threaded (or may be multithreaded, with only >one thread running this scenario), all works fine. >But when this scenario executed concurently by many threads, the reading >process sometimes doesn't see, that pipe was closed and reading process >is stuck in read() (piperd wchan), and write process is stuck in waitpid. > >Is it a bug somewhere or I missing something? Gennady, I think there is a bug in your code. While a forked process has just the thread that called fork(), the file descriptor table is the exact copy. So, you may end up with multiple processes, each possibly having an open end of a few writing ends of pipes used in another processes. So, as long there are potentically more writers, you can't get EOF. J. -- Jan Pechanec http://www.devnull.cz From owner-freebsd-threads@FreeBSD.ORG Sat Dec 5 20:40:02 2009 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 166F9106566C for ; Sat, 5 Dec 2009 20:40:02 +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 CD7028FC17 for ; Sat, 5 Dec 2009 20:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5Ke1Iu097258 for ; Sat, 5 Dec 2009 20:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nB5Ke127097257; Sat, 5 Dec 2009 20:40:01 GMT (envelope-from gnats) Resent-Date: Sat, 5 Dec 2009 20:40:01 GMT Resent-Message-Id: <200912052040.nB5Ke127097257@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, Jeremy Huddleston Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C1021065670 for ; Sat, 5 Dec 2009 20:34:42 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0166D8FC0C for ; Sat, 5 Dec 2009 20:34:42 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KYfrD000396 for ; Sat, 5 Dec 2009 20:34:41 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nB5KYfaY000395; Sat, 5 Dec 2009 20:34:41 GMT (envelope-from nobody) Message-Id: <200912052034.nB5KYfaY000395@www.freebsd.org> Date: Sat, 5 Dec 2009 20:34:41 GMT From: Jeremy Huddleston To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: threads/141198: src/lib/libc/stdio does not properly initialize mutexes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:40:02 -0000 >Number: 141198 >Category: threads >Synopsis: src/lib/libc/stdio does not properly initialize mutexes >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Dec 05 20:40:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Jeremy Huddleston >Release: 8.0 >Organization: Apple >Environment: NA >Description: libc/stdio assumes PTHREAD_MUTEX_INITIALIZER is NULL (which it is in FreeBSD), but this makes the code not as portable. Earlier versions of stdio did properly initialize the lock to PTHREAD_MUTEX_INITIALIZER in INITEXTRA() when it was part of the _extra extension substructure. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: