From owner-freebsd-threads@FreeBSD.ORG Thu Aug 26 06:10:23 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 4D19816A4CE for ; Thu, 26 Aug 2004 06:10:23 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2296143D1F for ; Thu, 26 Aug 2004 06:10:23 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i7Q6AN7Z029486 for ; Thu, 26 Aug 2004 06:10:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i7Q6AMwV029485; Thu, 26 Aug 2004 06:10:23 GMT (envelope-from gnats) Resent-Date: Thu, 26 Aug 2004 06:10:23 GMT Resent-Message-Id: <200408260610.i7Q6AMwV029485@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, "Maarten L. Hekkelman" 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 X-Send-Pr-Version: www-2.3 Subject: threads/70975: unexpected and unreliable behaviour when using SYSV semaphore, fork and pipe 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, 26 Aug 2004 06:10:23 -0000 >Number: 70975 >Category: threads >Synopsis: unexpected and unreliable behaviour when using SYSV semaphore, fork and pipe >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 26 06:10:22 GMT 2004 >Closed-Date: >Last-Modified: >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: >Unformatted: