From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.bugs Subject: Re: [bug #33996] 2.0.2: Crash related to ports and threads Date: Thu, 18 Aug 2011 11:36:37 +0200 Message-ID: <871uwjhxi2.fsf@pobox.com> References: <20110812-094212.sv11689.31911@savannah.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1313669260 4481 80.91.229.12 (18 Aug 2011 12:07:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 18 Aug 2011 12:07:40 +0000 (UTC) Cc: bug-guile@gnu.org, guile-devel To: Cedric Cellier , Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Aug 18 14:07:33 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qu1Nk-00081k-Hx for guile-devel@m.gmane.org; Thu, 18 Aug 2011 14:07:32 +0200 Original-Received: from localhost ([::1]:41066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qu1Nj-0004PI-T4 for guile-devel@m.gmane.org; Thu, 18 Aug 2011 08:07:31 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qu1Ng-0004Lq-MP for guile-devel@gnu.org; Thu, 18 Aug 2011 08:07:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qu1Nf-0000XG-J9 for guile-devel@gnu.org; Thu, 18 Aug 2011 08:07:28 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:41334 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qu1Nc-0000WU-Jc; Thu, 18 Aug 2011 08:07:24 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 4C9AA6401; Thu, 18 Aug 2011 08:07:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=pT0LhXtmFYd0SPXpae5mWMWYtwA=; b=f/ZQ8w Jcr2mwEfCgVsyprhtUmGz+qXnXvmuQCEdC0kT4DJYi83LhecOXDf8HSauK0V/1Kg fb5yox2gHzE4rM7qzIvu4Zv+LzDYF2YLAVNP6NS/Ya53ZEqcf/LqPDbKdgMb20XQ O9AZP7kKOJjgrE9VY74USNobTEk1oEuhYU374= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=QHE1lmTp7m2bKp0cXzG6S9heKbLJgQ1U VxDlFbCgKgc7NSUb0klBkamV/8c5vr98jzOVXg3rcYzpxDMuyLLPS+PufeamvKcW 3fcghJqGkhpiq6iJu6tABoi+8Xq5je6M8eossYJRKzB/Cc6/DSrDFXWRiD+Rb4Hm 65FjTwnWRnQ= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 45D446400; Thu, 18 Aug 2011 08:07:24 -0400 (EDT) Original-Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id AC73C63FF; Thu, 18 Aug 2011 08:07:23 -0400 (EDT) In-Reply-To: <20110812-094212.sv11689.31911@savannah.gnu.org> (Cedric Cellier's message of "Fri, 12 Aug 2011 07:42:13 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: A1D31DA2-C992-11E0-89FE-B797DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12703 gmane.lisp.guile.bugs:5783 Archived-At: Hi Cedric, On Fri 12 Aug 2011 09:42, Cedric Cellier writes: > (use-modules (ice-9 threads)) > > (define (forever f) > (f) > (forever f)) > > ; Spawn a thread that performs some writes > (make-thread forever (lambda () > (display "write...\n"))) > > (forever (lambda () (display "new pipe...\n"))) Oh dear, this is a nasty one. The issue is that Guile's ports are not threadsafe. I hadn't thought about this one... I am adding guile-devel to the Cc for input. Any fix to this will be pretty big, I think. I think that the right fix here is probably what Glibc does; see `info libc "Streams and Threads"` for the full details. Basically they add a lock to each FILE*, which is probably what we should do with our ports. We could investigate Java's biased locking, if that's useful. Andy -- http://wingolog.org/