Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 96011 invoked from network); 10 Jan 2007 13:12:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jan 2007 13:12:19 -0000 Received: (qmail 9713 invoked by uid 500); 10 Jan 2007 13:12:19 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 9675 invoked by uid 500); 10 Jan 2007 13:12:19 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 9661 invoked by uid 99); 10 Jan 2007 13:12:19 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jan 2007 05:12:19 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: 216.86.168.178 is neither permitted nor denied by domain of geir@pobox.com) Received: from [216.86.168.178] (HELO mxout-03.mxes.net) (216.86.168.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jan 2007 05:12:08 -0800 Received: from [10.251.213.123] (unknown [208.54.95.1]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id BA2455193D for ; Wed, 10 Jan 2007 08:11:47 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <51d555c70701091014n6f6874ocdb08fdeb383213e@mail.gmail.com> References: <97EB9EC8-ECCD-4E9A-A165-F16310C37133@pobox.com> <4dd1f3f00701090751w23e9e3b5pcef55055f201544e@mail.gmail.com> <51d555c70701091014n6f6874ocdb08fdeb383213e@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3A2DFD3D-60F3-477C-838F-E7BAD8F22FBB@pobox.com> Content-Transfer-Encoding: 7bit From: "Geir Magnusson Jr." Subject: Re: [drlvm] stress.Mix / MegaSpawn threading bug Date: Wed, 10 Jan 2007 08:11:46 -0500 To: dev@harmony.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org On Jan 9, 2007, at 1:14 PM, Rana Dasgupta wrote: > On 1/9/07, Weldon Washburn wrote: >> >> On 1/9/07, Gregory Shimansky wrote: >> >> I've tried to analyze MegaSpawn test on windows and here's what >> I found >> >> out. >> >> >> >> OOME is thrown because process virtual size easily gets up to >> 2Gb. This >> >> happens at about ~1.5k simultaneously running threads. I think it >> >> happens because all of virtual process memory is mapped for thread >> stacks. >> >> >> >> >Good job! I got the same sort of hunch when I looked at the >> source code >> did >> >not have enough time to pin down specifics. The only guidance I >> >found regarding what happens when too many threads are spawned is >> the >> >following in the java.lang.Thread reference manual, "...specifying a >> lower >> >[stacksize] value may allow a greater number of threads to exist >> >concurrently without throwing an OutOfMemoryError (or other internal >> >error)." >> >> >I think what the above implies is that it is OK for the JVM to >> error and >> >exit if the app tries to create too many threads. If this is the >> case, >> it >> >sort of looks like we need to clean up the handling of malloc() >> errors so >> >that the JVM can exit gracefully. > > > I am not sure that we need to do something about this. The default > initial > stack size on Windows is 1M, Yikes! There's our problem on windows... > and that is the recommended init size for real > applications. The fact that our threads start with a larger intial > stack > mapped( default ) than RI is a design issue, it is not a bug. We > could start > with 2K and create many more threads! That's right. The fact that the VM crashes and burns is the bug, and a serious one, IMO. > Exactly as Gregory points out, > ultimately we will hit virtual memory limits and fail. The reason > the RI > seems to fail less is that the test ends before running out of virtual > memory.On my 32 bit RHEL Linux box, RI fails almost every time with > MegaSpawn, with an identical OOME error message and stack dump. > > We can catch the exception in the test and print a message. But I > am not > very sure what purpose that would serve. A resource exhaustion > exception is > a fatal exception and the process is hosed, No, it's not. > no real app would be able to do > anything more at this point. That's not true. > We should not use this test ( which is not a > real app ) as guidance to tune the initial stack size. My > suggestion is to > lower the test duration so that we can create about a 1000( or > whatever > magic number ) threads at least. That is the stress condition we > should test > for. The big thing for me is ensuring that we can drive the VM to the limit, and it maintains internal integrity, so applications that are designed to gracefully deal with resource exhaustion can do so w/ confidence that the VM isn't about to crumble out from underneath them. geir > a > Thanks, > Rana