From nobody@FreeBSD.org Thu Aug 26 06:04:16 2004 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E9E0916A4CE for ; Thu, 26 Aug 2004 06:04:16 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA7D643D41 for ; Thu, 26 Aug 2004 06:04:16 +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 i7Q64GG4031708 for ; Thu, 26 Aug 2004 06:04:16 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i7Q64G1p031707; Thu, 26 Aug 2004 06:04:16 GMT (envelope-from nobody) Message-Id: <200408260604.i7Q64G1p031707@www.freebsd.org> Date: Thu, 26 Aug 2004 06:04:16 GMT From: "Maarten L. Hekkelman" To: freebsd-gnats-submit@FreeBSD.org Subject: unexpected and unreliable behaviour when using SYSV semaphore, fork and pipe X-Send-Pr-Version: www-2.3 >Number: 70975 >Category: threads >Synopsis: [sysvipc] unexpected and unreliable behaviour when using SYSV semaphore, fork and pipe >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 26 06:10:22 GMT 2004 >Closed-Date: Sun Apr 25 11:26:14 UTC 2010 >Last-Modified: Sun Apr 25 11:26:14 UTC 2010 >Originator: Maarten L. Hekkelman >Release: 5.2.1-RELEASE-p8 >Organization: Radboud Universiteit Nijmegen, Afd. CMBI >Environment: FreeBSD cmbidb1.cmbi.kun.nl 5.2.1-RELEASE-p8 FreeBSD 5.2.1-RELEASE-p8 #6: Thu Aug 19 08:19:25 CEST 2004 root@cmbidb1.cmbi.kun.nl:/usr/obj/usr/src/sys/MY_KERNEL i386 >Description: I have some code that works fine on IRIX and Linux but fails on FreeBSD. What I do is start a number of threads (using pthreads) that each create a pipe and fork/exec a subprocess to read from using the pipe. The problem is that either the code blocks on reading from the pipe, even when O_NONBLOCK is set. Or the semaphore created with semget fails when I try to call semop with it after a number of times. I'm using this semaphore to limit the number of running threads. The error code after semop fails is always "Interrupted system call". As noted before, the code works fine on other OS's Linux and IRIX. I believe it used to work in FreeBSD 4.6 but I'm not sure, it doesn't work with 4.9. >How-To-Repeat: Source code for an app showing this behaviour can be found at http://www.hekkelman.com/~maarten/test.cpp Run the app with two parameters, the first is the number of threads to use and the second is the number of subprocesses to spawn. >Fix: >Release-Note: >Audit-Trail: From: David Xu To: bug-followup@freebsd.org, m.hekkelman@cmbi.kun.nl Cc: Subject: Re: threads/70975: unexpected and unreliable behaviour when using SYSV semaphore, fork and pipe Date: Mon, 29 May 2006 19:32:56 +0800 Can you reproduce it on 6.1-RELEASE ? David Xu State-Changed-From-To: open->closed State-Changed-By: jilles State-Changed-When: Sun Apr 25 11:26:12 UTC 2010 State-Changed-Why: The problem is that with libc_r SysV semaphores will block the entire process. We are sorry that this will not be fixed in libc_r, but the newer threading libraries do not have this problem. http://www.freebsd.org/cgi/query-pr.cgi?pr=70975 >Unformatted: