From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jan 16 09:14:30 2006 Return-Path: X-Original-To: freebsd-ports-bugs@FreeBSD.org Delivered-To: freebsd-ports-bugs@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C63D316A426; Mon, 16 Jan 2006 09:14:30 +0000 (GMT) (envelope-from kasahara@nc.kyushu-u.ac.jp) Received: from elvenbow.nc.kyushu-u.ac.jp (elvenbow.nc.kyushu-u.ac.jp [133.5.6.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D58F43D5D; Mon, 16 Jan 2006 09:14:22 +0000 (GMT) (envelope-from kasahara@nc.kyushu-u.ac.jp) Received: from localhost (kasahara@elvenbow.nc.kyushu-u.ac.jp [127.0.0.1]) by elvenbow.nc.kyushu-u.ac.jp (8.13.4/8.13.4) with ESMTP id k0G9EGsK059457; Mon, 16 Jan 2006 18:14:17 +0900 (JST) (envelope-from kasahara@nc.kyushu-u.ac.jp) Date: Mon, 16 Jan 2006 18:14:16 +0900 (JST) Message-Id: <20060116.181416.46014020.kasahara@nc.kyushu-u.ac.jp> To: pav@FreeBSD.org From: Yoshiaki Kasahara In-Reply-To: <200601141330.k0EDURPC006413@freefall.freebsd.org> References: <200601141330.k0EDURPC006413@freefall.freebsd.org> X-Fingerprint: CDA2 B6B6 6796 0DD3 9D80 2602 E909 4623 A15E A074 X-URL: http://www.nc.kyushu-u.ac.jp/~kasahara/ X-Mailer: Mew version 4.2.52 on Emacs 22.0.51 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/81464: ruby-1.8.2_3 stack handling broken due to libpthread linkage X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2006 09:14:30 -0000 I have just upgraded to ruby-1.8.4_1,1 (now my system is 6.0R BTW), and noticed the stack size has become even narrower. Now the test script in my report can iterate only 340 times (and crashes). 339 340 zsh: 7600 illegal hardware instruction (core dumped) ruby test.rb Here is a simple patch to change configure args when WITHOUT_PTHREAD is defined. Ruby always has its own thread mechanism (I believe it doesn't use pthread for its thread mechanism anyway), so I changed the name of the variable from "WITHOUT_THREADS" to "WITHOUT_PTHREAD". diff -ur ruby18.o/Makefile ruby18/Makefile --- ruby18.o/Makefile Sun Jan 15 03:57:17 2006 +++ ruby18/Makefile Mon Jan 16 16:32:45 2006 @@ -39,8 +39,14 @@ GNU_CONFIGURE= yes WRKSRC= ${RUBY_WRKSRC} CONFIGURE_ARGS= ${RUBY_CONFIGURE_ARGS} \ - --enable-shared --enable-pthread \ + --enable-shared \ --with-openssl-include=${OPENSSLINC} + +.if defined(WITHOUT_PTHREAD) +CONFIGURE_ARGS+= --disable-pthread +.else +CONFIGURE_ARGS+= --enable-pthread +.endif .if defined(DEBUG) CFLAGS+= -g And now it iterates over 50,000 times and correctly detects stack overflow (limit stacksize = 64MB). 51013 51014 test.rb:4:in `print': stack level too deep (SystemStackError) from test.rb:4:in `rec' from test.rb:5:in `rec' from test.rb:8 zsh: 17193 exit 1 ruby test.rb I'm sorry I'm not sure about compatibility issues with ruby-opengl, ruby-wx etc because I don't use these ports. I have only used the binary (without pthread) on my own system. When a binary is compiled with -pthread, the effective stack size is (greatly) reduced because the program runs inside a thread, and getrlimit() doesn't return the actual stack size. So, Ruby cannot detect the stack overflow.