From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: 'stop-server-and-clients!' can cause crash (was PATCH - Add cooperative REPL server module) Date: Tue, 21 Jan 2014 23:20:07 -0500 Message-ID: <871u00odfs.fsf_-_@netris.org> References: <877g9vbw2s.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> <87ha8zpj93.fsf@netris.org> <874n4yoc5b.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> <87d2jmpn4e.fsf@netris.org> <874n4ynsbw.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> <87zjmqnevz.fsf@netris.org> <871u00u6kv.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1390364677 9262 80.91.229.3 (22 Jan 2014 04:24:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jan 2014 04:24:37 +0000 (UTC) Cc: guile-devel@gnu.org To: David Thompson Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jan 22 05:24:43 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W5pMp-0000Ck-AL for guile-devel@m.gmane.org; Wed, 22 Jan 2014 05:24:43 +0100 Original-Received: from localhost ([::1]:33543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5pMo-0003b5-Lv for guile-devel@m.gmane.org; Tue, 21 Jan 2014 23:24:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5pMg-0003Zw-Cq for guile-devel@gnu.org; Tue, 21 Jan 2014 23:24:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5pMa-0000NL-8V for guile-devel@gnu.org; Tue, 21 Jan 2014 23:24:34 -0500 Original-Received: from world.peace.net ([96.39.62.75]:56809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5pMZ-0000NF-TY for guile-devel@gnu.org; Tue, 21 Jan 2014 23:24:28 -0500 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1W5pMM-0001bO-4y; Tue, 21 Jan 2014 23:24:17 -0500 In-Reply-To: <871u00u6kv.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (David Thompson's message of "Tue, 21 Jan 2014 20:51:44 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 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:16829 Archived-At: David Thompson writes: > Mark H Weaver writes: > >> Interesting. Does it happen with unmodified stable-2.0? If so, I think >> we can treat this as an independent bug. > > Yes, exact same problem on stable-2.0. > >> Can you reproduce the segfault while running meta/gdb-uninstalled-guile >> and get a backtrace? Alternatively, if you provide enough detail to >> reproduce the segfault, I can track it down. > > Here's the output from gdb: > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0x7ffff4ea2700 (LWP 13122)] > get_codepoint (port=port@entry=0xe13ff0, codepoint=codepoint@entry=0x7ffff4ea1334, buf=buf@entry=0x7ffff4ea1330 "(%`", > len=len@entry=0x7ffff4ea1338) at ports.c:1460 > 1460 update_port_lf (*codepoint, port); Ah yes, this makes sense. Ports in stable-2.0 are not thread-safe even for normal operations, and in this case 'stop-server-and-clients!' is _closing_ a port that's currently in use by another thread. In other words, 'stop-server-and-clients!' is fundamentally unsafe in the way it works, and probably has been since it was introduced. Thanks for the debugging. I'll think about how best to fix this. Mark