From: "Elias Mårtenson" <lokedhs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 25172@debbugs.gnu.org, "Clément Pit--Claudel" <clement.pit@gmail.com>
Subject: bug#25172: 26.0.50; Concurrency feature, sit-for doesn't work (crashing and unexpected behaviour)
Date: Tue, 13 Dec 2016 10:38:09 +0800 [thread overview]
Message-ID: <CADtN0WKJXehBHQqN5AiWCEauBdhmTXzw_oZXBrr3qsJLLpZYnA@mail.gmail.com> (raw)
In-Reply-To: <838trlcals.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2876 bytes --]
I was about to test this, but I have been unable to reproduce the problem
as of the current version: 8db7b65d66f01e90a05cc9f11c67667233d84ca0
Has a fix for this been explicitly committed, or did the behaviour change
unexpectedly because of some other change?
Regards,
Elias
On 13 December 2016 at 01:37, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Elias Mårtenson <lokedhs@gmail.com>
> > Date: Mon, 12 Dec 2016 12:50:24 +0800
> > Cc: Eli Zaretskii <eliz@gnu.org>, 25172@debbugs.gnu.org
> >
> > I tried with the latest version (a92a027d58cb4df5bb6c7e3c546a72
> 183a192f45)
> > and I'm still getting the same error.
> >
> > The stack trace is as follows:
> > [...]
> > #34 0x0000000000578a22 in emacs_abort () at sysdep.c:2342
> > #35 0x0000000000564247 in unblock_input_to (level=-1) at keyboard.c:7167
> > #36 0x000000000056425e in unblock_input () at keyboard.c:7183
> > #37 0x000000000069c5e4 in xg_select (fds_lim=15, rfds=0x7fffe59e19a0,
> > wfds=0x7fffe59e1920, efds=0x0, timeout=0x7fffe59e1900, sigmask=0x0) at
> > xgselect.c:162
>
> xg_select uses block_input/unblock_input, something other *select
> implementations used by Emacs don't do (as those others are system
> APIs). block_input/unblock_input manipulate a global variable that is
> not incremented and decremented atomically, so it's fundamentally
> thread-unsafe. Moreover, some places in Emacs reset that global
> variable to zero (although I don't believe those places are part of
> your scenario).
>
> The above is especially important because the calls to the *select
> functions are about the only place in Emacs where several threads can
> run in parallel, because they are called by thread_select like this:
>
> release_global_lock ();
> sa->result = (sa->func) (sa->max_fds, sa->rfds, sa->wfds, sa->efds,
> sa->timeout, sa->sigmask);
> acquire_global_lock (self);
>
> So between the call to release_global_lock, which allows another
> thread to grab the lock, and the subsequent call to
> acquire_global_lock several threads could run and more or less
> simultaneously call the *select function. If that function is
> xg_select, these threads might step on each other's toes by calling
> block_input/unblock_input in parallel. This could easily cause the
> global variable to become negative, which then causes the above abort.
>
> Long story short, could you please try removing the calls to
> block_input/unblock_input from xgselect.c, and see if that solves
> these crashes? (These calls were introduced to fix a rare and elusive
> bug, but I don't think you will see that bug unless you do what that
> bug's recipe calls for. And anyway, this removal is just so we see
> whether this is indeed the reason for the problem, I don't really
> suggest to remove them for good.)
>
> Thanks.
>
[-- Attachment #2: Type: text/html, Size: 3616 bytes --]
next prev parent reply other threads:[~2016-12-13 2:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-11 16:35 bug#25172: 26.0.50; Concurrency feature, sit-for doesn't work (crashing and unexpected behaviour) Elias Mårtenson
2016-12-11 16:47 ` Andreas Schwab
2016-12-11 16:49 ` Elias Mårtenson
2016-12-11 17:54 ` Eli Zaretskii
2016-12-11 17:52 ` Eli Zaretskii
2016-12-11 19:05 ` Clément Pit--Claudel
2016-12-12 4:50 ` Elias Mårtenson
2016-12-12 17:37 ` Eli Zaretskii
2016-12-13 2:38 ` Elias Mårtenson [this message]
2016-12-13 3:40 ` Eli Zaretskii
2016-12-13 3:45 ` Elias Mårtenson
2016-12-13 4:11 ` Elias Mårtenson
2016-12-13 4:14 ` Elias Mårtenson
2016-12-13 4:16 ` Elias Mårtenson
2016-12-13 16:26 ` Eli Zaretskii
2016-12-14 2:58 ` Elias Mårtenson
2016-12-14 3:00 ` Elias Mårtenson
2016-12-14 3:02 ` Elias Mårtenson
2016-12-14 16:03 ` Eli Zaretskii
2016-12-14 16:12 ` Elias Mårtenson
2016-12-15 3:30 ` Elias Mårtenson
2016-12-15 16:22 ` Eli Zaretskii
2016-12-15 16:28 ` Elias Mårtenson
2016-12-15 16:59 ` Eli Zaretskii
2016-12-13 16:23 ` Eli Zaretskii
2016-12-13 18:25 ` Andreas Schwab
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/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADtN0WKJXehBHQqN5AiWCEauBdhmTXzw_oZXBrr3qsJLLpZYnA@mail.gmail.com \
--to=lokedhs@gmail.com \
--cc=25172@debbugs.gnu.org \
--cc=clement.pit@gmail.com \
--cc=eliz@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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).