Eric Wong <normalperson / yhbt.net> wrote:
> normalperson / yhbt.net wrote:
> >  I propose the following to test inside threads:
> >  http://bogomips.org/ruby.git/patch?id=a2c08435f4346
> 
> Bah, that fails on my 32-bit Debian 7.0 VM; I only tried
> 64-bit before.  I will investigate tomorrow or day after.

Setting a 12K guard stack seems to solve the problem for me,
but it is not ideal.  An 8K guard stack is not enough, even(!)

I do not believe a giant guard is worth it for a corner-case
(especially since the main thread has no guard at all).

These tests may be too platform-dependent to support, even for common
Linux systems.

--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -936,6 +936,8 @@ native_thread_create(rb_thread_t *th)
 	CHECK_ERR(pthread_attr_setstacksize(&attr, stack_size));
 # endif
 
+	CHECK_ERR(pthread_attr_setguardsize(&attr, 12 * 1024));
+
 # ifdef HAVE_PTHREAD_ATTR_SETINHERITSCHED
 	CHECK_ERR(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED));
 # endif