unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: David Thompson <dthompson2@worcester.edu>
Cc: guile-devel@gnu.org
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	[thread overview]
Message-ID: <871u00odfs.fsf_-_@netris.org> (raw)
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")

David Thompson <dthompson2@worcester.edu> writes:

> Mark H Weaver <mhw@netris.org> 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



      parent reply	other threads:[~2014-01-22  4:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-19 19:39 PATCH - Add cooperative REPL server module David Thompson
2014-01-20  0:52 ` Mark H Weaver
     [not found]   ` <874n4yoc5b.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me>
     [not found]     ` <87d2jmpn4e.fsf@netris.org>
     [not found]       ` <874n4ynsbw.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me>
2014-01-20 23:36         ` Fwd: " Thompson, David
2014-01-21  4:21           ` Mark H Weaver
2014-01-22  1:51             ` David Thompson
2014-01-22  3:36               ` Mark H Weaver
2014-01-22 12:17                 ` David Thompson
2014-01-22  4:20               ` Mark H Weaver [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871u00odfs.fsf_-_@netris.org \
    --to=mhw@netris.org \
    --cc=dthompson2@worcester.edu \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).