From: Aaron Jensen <aaronjensen@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 30364@debbugs.gnu.org, Alan Third <alan@idiocy.org>,
Paul Eggert <eggert@cs.ucla.edu>,
Noam Postavsky <npostavs@users.sourceforge.net>,
Noam Postavsky <npostavs@gmail.com>,
Andreas Schwab <schwab@linux-m68k.org>
Subject: bug#30364: 26.0.91; thread crash on macos
Date: Wed, 28 Feb 2018 10:07:52 -0800 [thread overview]
Message-ID: <CAHyO48wW6wnrruw46RWSKrwOUULwnex+SACAVOdkjmVCqDiAhg@mail.gmail.com> (raw)
In-Reply-To: <CAHyO48zZOzRXsLXcj0jD8K=YJt0rmd137yzte-iZXryNTS2ngw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
On Wed, Feb 28, 2018 at 9:59 AM, Aaron Jensen <aaronjensen@gmail.com> wrote:
>> If you want to make a macOS-only change that enlarges its stack we
>> give to threads, I can live with that on emacs-26, provided that the
>> fix only affects threads other than the main one.
Attached. AFAICT sys_create_thread is only used by make-thread.
[-- Attachment #2: 0001-Require-a-larger-stack-size-for-threads-on-macOS-bug.patch --]
[-- Type: application/octet-stream, Size: 1208 bytes --]
From 56d9daa184f9e7fab34524863fdeaba52a742a8e Mon Sep 17 00:00:00 2001
From: Aaron Jensen <aaronjensen@gmail.com>
Date: Wed, 28 Feb 2018 10:05:30 -0800
Subject: [PATCH] Require a larger stack size for threads on macOS (bug#30364)
* src/systhread.c (sys_thread_create) [THREADS_ENABLED && HAVE_PTHREAD]:
Require at least 8MB stack size for x64 and 4MB for x86 on macOS.
---
src/systhread.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/systhread.c b/src/systhread.c
index 4ffb7db143..550318d90f 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -165,6 +165,15 @@ sys_thread_create (sys_thread_t *thread_ptr, const char *name,
if (pthread_attr_init (&attr))
return 0;
+#if defined (DARWIN_OS)
+ /* Avoid crash on macOS with deeply nested GC (Bug#30364). */
+ size_t stack_size;
+ size_t required_stack_size = sizeof (void *) * 1024 * 1024;
+ if (pthread_attr_getstacksize (&attr, &stack_size) == 0
+ && stack_size < required_stack_size)
+ pthread_attr_setstacksize (&attr, required_stack_size);
+#endif
+
if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED))
{
result = pthread_create (thread_ptr, &attr, func, arg) == 0;
--
2.15.1
next prev parent reply other threads:[~2018-02-28 18:07 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHyO48wW6wnrruw46RWSKrwOUULwnex+SACAVOdkjmVCqDiAhg@mail.gmail.com \
--to=aaronjensen@gmail.com \
--cc=30364@debbugs.gnu.org \
--cc=alan@idiocy.org \
--cc=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--cc=npostavs@gmail.com \
--cc=npostavs@users.sourceforge.net \
--cc=schwab@linux-m68k.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 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.