unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: 30364@debbugs.gnu.org, npostavs@gmail.com,
	npostavs@users.sourceforge.net
Subject: bug#30364: 26.0.91; thread crash on macos
Date: Sat, 17 Feb 2018 20:55:54 +0200	[thread overview]
Message-ID: <83inavbg3p.fsf@gnu.org> (raw)
In-Reply-To: <CAHyO48wO6ovhhA958fF9jcR8dThip1kytQ8XdNkK4oTztSoPJg@mail.gmail.com> (message from Aaron Jensen on Sat, 17 Feb 2018 10:40:10 -0800)

> From: Aaron Jensen <aaronjensen@gmail.com>
> Date: Sat, 17 Feb 2018 10:40:10 -0800
> Cc: Noam Postavsky <npostavs@gmail.com>, 30364@debbugs.gnu.org, 
> 	Noam Postavsky <npostavs@users.sourceforge.net>
> 
> On Sat, Feb 17, 2018 at 10:17 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > When this crashes, is one of the threads you launched always doing GC,
> > like in the first backtrace you've shown?
> 
> I can tell this by the mark_object/mark_vectorlike calls in the stack,
> right?

Yes.

> Ultimately, I was trying to port company-dabbrev to use threads. I
> noticed the crash while working on it, so the 100 threads at the same
> time was just a way of more consistently reproducing it. I could
> probably have run the 100 threads serially to reproduce it, I don't
> know.

They do run serially, the way you wrote the code.  The call to
make-thread creates the thread, but the thread doesn't run, it waits
for the currently-running thread to release the global lock.
Normally, I'd expect the first of the 100 threads to start running
almost immediately, because you don't do anything in the main thread.
But the other 99 will wait.  Whether some of them will start running
before the first one exits, depends on the code of the thread
function, and you didn't show all of it: I understand that the bulk is
in company-mode.

> I don't know what this is, but I do know that there are
> (input-pending-p)'s in the thread from the current implementation.

Where are they?  I don't see those input-pending-p calls in the code
on the page to which you referred. 

> They don't need to be there (i guess they'd be replaced by
> thread-yields, but when I did that it got very slow). I don't have
> time to test if removing those fixes the crashes just yet, but could
> that be causing the crash? The thread also calls `message`, I don't
> know if that's considered "UI stuff"

If we are to believe to the backtrace, the thread that crashed was the
main thread, and it crashed inside pthread_mutex_lock.  Which probably
means some snafu with pthreads synchronization functions.  But the NS
port has some complicated architecture wrt threads, so maybe that's
why it crashes.





  reply	other threads:[~2018-02-17 18:55 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06  8:21 bug#30364: 26.0.91; thread crash on macos Aaron Jensen
2018-02-14  1:05 ` Noam Postavsky
2018-02-14  1:22   ` Aaron Jensen
2018-02-17 14:44     ` Noam Postavsky
2018-02-17 17:58       ` Aaron Jensen
2018-02-17 18:17         ` Eli Zaretskii
2018-02-17 18:40           ` Aaron Jensen
2018-02-17 18:55             ` Eli Zaretskii [this message]
2018-02-18  1:58               ` Aaron Jensen
2018-02-18  4:51                 ` Eli Zaretskii
2018-02-18  4:54                   ` Aaron Jensen
2018-02-18 16:45                     ` Eli Zaretskii
     [not found]                       ` <CAHyO48y+c21biWxQDTMvW2PkSKW6TzZVWQ94yUPN_4n3utDv5A@mail.gmail.com>
2018-02-18 18:25                         ` Eli Zaretskii
2018-02-18 18:38                           ` Aaron Jensen
2018-02-18 18:39                             ` Aaron Jensen
2018-02-18 18:59                               ` Aaron Jensen
2018-02-18 19:32                                 ` Eli Zaretskii
2018-02-18 19:49                                   ` Aaron Jensen
2018-02-18 20:15                                     ` Eli Zaretskii
2018-02-18 21:12                                       ` Aaron Jensen
2018-02-19  3:29                                         ` Eli Zaretskii
2018-02-19 17:24                                           ` Paul Eggert
2018-02-19 17:29                                             ` Daniel Colascione
2018-02-19 18:39                                               ` Eli Zaretskii
2018-02-19 18:33                                             ` Eli Zaretskii
2018-02-19 18:47                                               ` Aaron Jensen
2018-02-19 20:08                                                 ` Paul Eggert
2018-02-19 20:16                                                   ` Aaron Jensen
2018-02-25 20:52                                                     ` Aaron Jensen
2018-02-27 17:30                                                       ` Paul Eggert
2018-02-27 17:38                                                         ` Aaron Jensen
2018-02-27 17:44                                                           ` Paul Eggert
2018-02-28  5:33                                                         ` Aaron Jensen
2018-02-28 15:33                                                           ` Eli Zaretskii
2018-02-28 15:35                                                             ` Aaron Jensen
2018-02-28 16:20                                                               ` Eli Zaretskii
2018-02-28 17:32                                                                 ` Aaron Jensen
2018-02-28 17:38                                                                   ` Eli Zaretskii
2018-02-28 17:59                                                                     ` Aaron Jensen
2018-02-28 18:07                                                                       ` Aaron Jensen
2018-02-28 19:15                                                                         ` Paul Eggert
2018-02-28 20:36                                                                           ` Eli Zaretskii
2018-03-01  0:31                                                                             ` Paul Eggert
2018-03-01  8:37                                                                               ` Aaron Jensen
2018-05-13 15:13                                                                               ` Noam Postavsky
2018-05-13 16:26                                                                                 ` Eli Zaretskii
2018-05-14 20:03                                                                                   ` Paul Eggert
2018-02-28 16:19                                                           ` Paul Eggert
2018-02-18 19:07                               ` Eli Zaretskii
2018-02-18 19:04                             ` Eli Zaretskii
2018-02-18 11:01                 ` Alan Third
2018-02-17 18:23         ` Alan Third

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=83inavbg3p.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30364@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    --cc=npostavs@gmail.com \
    --cc=npostavs@users.sourceforge.net \
    /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).