From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: racing srfi-18 threads Date: Mon, 16 Nov 2009 22:16:31 +0000 Message-ID: <87skceglog.fsf@ossau.uklinux.net> References: <2e6d10880911060129s538fab2cv84805475450f33d0@mail.gmail.com> <2e6d10880911060652g56092de3g649c540e54102c05@mail.gmail.com> <87bpjcy4bc.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1258409821 18750 80.91.229.12 (16 Nov 2009 22:17:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Nov 2009 22:17:01 +0000 (UTC) Cc: guile-user@gnu.org, Guile Development To: Tristan Colgate Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Nov 16 23:16:54 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NA9sR-0004oQ-RZ for guile-devel@m.gmane.org; Mon, 16 Nov 2009 23:16:52 +0100 Original-Received: from localhost ([127.0.0.1]:51866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NA9sR-0000aJ-6E for guile-devel@m.gmane.org; Mon, 16 Nov 2009 17:16:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NA9sK-0000XK-2M for guile-devel@gnu.org; Mon, 16 Nov 2009 17:16:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NA9sF-0000RN-JE for guile-devel@gnu.org; Mon, 16 Nov 2009 17:16:43 -0500 Original-Received: from [199.232.76.173] (port=38276 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NA9sF-0000RF-DB; Mon, 16 Nov 2009 17:16:39 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]:46136) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NA9sE-0000vD-Vn; Mon, 16 Nov 2009 17:16:39 -0500 Original-Received: from arudy (host86-145-153-90.range86-145.btcentralplus.com [86.145.153.90]) by mail3.uklinux.net (Postfix) with ESMTP id 175931F6945; Mon, 16 Nov 2009 22:16:36 +0000 (GMT) Original-Received: from arudy (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id 15B3B38023; Mon, 16 Nov 2009 22:16:32 +0000 (GMT) In-Reply-To: <87bpjcy4bc.fsf@ossau.uklinux.net> (Neil Jerram's message of "Sun, 08 Nov 2009 23:39:19 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:9685 gmane.lisp.guile.user:7490 Archived-At: Neil Jerram writes: > Tristan Colgate writes: > >> A similar, though much simpler, test case exhibits the same problem. >> I'll raise a bug. report and >> include a log of the issue. > > Hi Tristan, > > Thanks for reporting this. FWIW I've checked that it still happens > (exactly as you've described) with the current Git HEAD. Not much clue > yet about the underlying problem or fix, but I'll keep looking. What happens is that each of the spawned threads throws an exception before it gets going. If I run test-broken in the (srfi srfi-18) module, with the following code added at the end: (write threads) (newline) (for-each (lambda (t) (write (thread->exception t)) (newline)) threads) (for-each thread-join! threads) I see: =============== build thread build thread build thread build thread build thread build thread (# # # # # #) ((uncaught-exception) wrong-type-arg "with-exception-handler" "Wrong type argument: ~S" (#) ()) ((uncaught-exception) wrong-type-arg "with-exception-handler" "Wrong type argument: ~S" (#) ()) ((uncaught-exception) wrong-type-arg "with-exception-handler" "Wrong type argument: ~S" (#) ()) ((uncaught-exception) wrong-type-arg "with-exception-handler" "Wrong type argument: ~S" (#) ()) ((uncaught-exception) wrong-type-arg "with-exception-handler" "Wrong type argument: ~S" (#) ()) ((uncaught-exception) wrong-type-arg "with-exception-handler" "Wrong type argument: ~S" (#) ()) =============== This is apparently because of srfi-18.scm's `with-exception-handler' including (check-arg-type thunk? thunk "with-exception-handler") It seems that when run under the VM, (thunk? thunk) => #f. scm_thunk_p depends on scm_i_program_arity, which depends on scm_program_arities, and adding this - (write ((@ (system vm program) program-arities) thunk)) (newline) (write (procedure-property thunk 'arity)) (newline) - into srfi-18's make-thread code, I get #f #f every time. So I think this is a good point to report and ask if this makes sense. Andy / Ludo, can it be correct for (program-arities PROGRAM) to be #f ? If not, any idea what is the root cause of this? Another question here is why the thread-join! doesn't cause the uncaught thread exceptions to be raised on the main thread. I'll look further into that. Thanks, Neil