From: Eli Zaretskii <eliz@gnu.org>
To: "Elias Mårtenson" <lokedhs@gmail.com>
Cc: 25172@debbugs.gnu.org, clement.pit@gmail.com
Subject: bug#25172: 26.0.50; Concurrency feature, sit-for doesn't work (crashing and unexpected behaviour)
Date: Mon, 12 Dec 2016 19:37:19 +0200 [thread overview]
Message-ID: <838trlcals.fsf@gnu.org> (raw)
In-Reply-To: <CADtN0WKtNP=BhFfXLCGNjiTMADmLf4Cr+zE43y4-WqXFGVt8Jg@mail.gmail.com> (message from Elias Mårtenson on Mon, 12 Dec 2016 12:50:24 +0800)
> 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 (a92a027d58cb4df5bb6c7e3c546a72183a192f45)
> 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.
next prev parent reply other threads:[~2016-12-12 17:37 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 [this message]
2016-12-13 2:38 ` Elias Mårtenson
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=838trlcals.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=25172@debbugs.gnu.org \
--cc=clement.pit@gmail.com \
--cc=lokedhs@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.