Rei.Odaira / gmail.com wrote:
> Ruby CI on AIX have frequently hit SystemStackError since this change was introduced.
> http://rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/recent.html
> http://rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20170723T103301Z.fail.html.gz

Either that is the 16K buffer in IO.copy_stream (see below) or
OpenSSL itself is using lots of stack.  I don't think we can
fix OpenSSL... (curious, which version do you use?)

> > If there are platform-dependent test failures; excessive stack usage should be fixed; rather than increasing minimum values or removing these envs from testing.
> 
> How do you think we can fix the "excessive stack usage"?

Does Linux checkstack.pl work for your binaries?

  https://80x24.org/mirrors/linux.git/plain/scripts/checkstack.pl
  (usage in comment)


IO.copy_stream buffer:

Can you try the following patch to move allocation from stack
to heap?  It may slow down small copies a little, but releasing
GVL also hurts, so I doubt the slow down will be noticeable.

diff --git a/io.c b/io.c
index 60af120c18..f4b3fcec4a 100644
--- a/io.c
+++ b/io.c
@@ -10692,7 +10692,7 @@ nogvl_copy_stream_write(struct copy_stream_struct *stp, char *buf, size_t len)
 static void
 nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
 {
-    char buf[1024*16];
+    char *buf;
     size_t len;
     ssize_t ss;
     int ret;
@@ -10702,6 +10702,13 @@ nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
     int use_pread;
 
     copy_length = stp->copy_length;
+    if (copy_length < 0) {
+	buf = xmalloc(16384);
+    }
+    else {
+	buf = xmalloc(copy_length > 16384 ? 16384 : copy_length);
+    }
+
     use_eof = copy_length == (off_t)-1;
     src_offset = stp->src_offset;
     use_pread = src_offset != (off_t)-1;


Thanks

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>