From owner-freebsd-ports-bugs@FreeBSD.ORG Wed May 25 12:30:03 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E919016A41C for ; Wed, 25 May 2005 12:30:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 97ABD43D1D for ; Wed, 25 May 2005 12:30:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4PCU2Nr084746 for ; Wed, 25 May 2005 12:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4PCU2l7084745; Wed, 25 May 2005 12:30:02 GMT (envelope-from gnats) Resent-Date: Wed, 25 May 2005 12:30:02 GMT Resent-Message-Id: <200505251230.j4PCU2l7084745@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Yoshiaki Kasahara Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F090516A41C for ; Wed, 25 May 2005 12:23:22 +0000 (GMT) (envelope-from kasahara@elvenbow.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 801E243D1D for ; Wed, 25 May 2005 12:23:22 +0000 (GMT) (envelope-from kasahara@elvenbow.nc.kyushu-u.ac.jp) Received: from elvenbow.nc.kyushu-u.ac.jp (kasahara@elvenbow.nc.kyushu-u.ac.jp [127.0.0.1]) by elvenbow.nc.kyushu-u.ac.jp (8.13.3/8.13.3) with ESMTP id j4PCNLfZ016420 for ; Wed, 25 May 2005 21:23:21 +0900 (JST) (envelope-from kasahara@elvenbow.nc.kyushu-u.ac.jp) Received: (from kasahara@localhost) by elvenbow.nc.kyushu-u.ac.jp (8.13.3/8.13.3/Submit) id j4PCNL5j016419; Wed, 25 May 2005 21:23:21 +0900 (JST) (envelope-from kasahara) Message-Id: <200505251223.j4PCNL5j016419@elvenbow.nc.kyushu-u.ac.jp> Date: Wed, 25 May 2005 21:23:21 +0900 (JST) From: Yoshiaki Kasahara To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: 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 Reply-To: Yoshiaki Kasahara List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2005 12:30:03 -0000 >Number: 81464 >Category: ports >Synopsis: ruby-1.8.2_3 stack handling broken due to libpthread linkage >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 25 12:30:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Yoshiaki Kasahara >Release: FreeBSD 5.4-RELEASE i386 >Organization: Kyushu University >Environment: System: FreeBSD elvenbow.nc.kyushu-u.ac.jp 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Thu May 12 11:13:40 JST 2005 root@elvenbow.nc.kyushu-u.ac.jp:/usr/obj/usr/src/sys/ELVENBOW i386 >Description: Running a deeply recursive script on ruby-1.8.2_3 causes "illegal hardware instruction" due to stack overflow. The Ruby interpreter should detect the overflow but it can't. Expanding the process stacksize has no effect. The effective stack size seems to be about 1MB. There is no such problem with ruby16. I suspect it is caused by unconditional linkage with libpthread specified in /usr/ports/lang/ruby18/Makefile. >How-To-Repeat: Run the following (permanently recursive) code with various setting of 'limit stacksize'. #!/usr/local/bin/ruby def rec(a) print "#{a}\n" rec(a+1) end rec(1) Even with stacksize=64MB, it crashes before 1000 iterations. With ruby16 (built without pthread), it goes far deeper and also detects stack overflow correctly (raise SystemStackError exception). >Fix: Remove CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" and LIB="${PTHREAD_LIBS}" from CONFIGURE_ENV. I don't know well about pthread, but I suspect there is (fixed?) stacksize limitation per thread. Probably Ruby doesn't know about that, and cannot detect the stack overflow. I'm sorry I'm not sure about issues with ruby-sdl and ruby-opengl etc mentioned in the CVS log. By the way, I noticed that Debian Linux had pthread enabled Ruby and it correctly detected stack overflow with larger process stacksize. Does it depend on libpthread implementation? >Release-Note: >Audit-Trail: >Unformatted: