Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 61532 invoked from network); 9 Jan 2007 18:14:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jan 2007 18:14:56 -0000 Received: (qmail 58237 invoked by uid 500); 9 Jan 2007 18:15:00 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 58209 invoked by uid 500); 9 Jan 2007 18:14:59 -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 58200 invoked by uid 99); 9 Jan 2007 18:14:59 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jan 2007 10:14:59 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of rdasgupt@gmail.com designates 64.233.162.234 as permitted sender) Received: from [64.233.162.234] (HELO nz-out-0506.google.com) (64.233.162.234) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jan 2007 10:14:50 -0800 Received: by nz-out-0506.google.com with SMTP id j2so2750447nzf for ; Tue, 09 Jan 2007 10:14:29 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=A1dfvv79F5Exk8szJWFaCMHKCbwMLnxX3YSxYUDIqjPki0WUgfFrOBdj2OewemeN9d8r43r2gWXuahW819KNQEqC2EKVeC0zGayT0HsT7iFcqR38tYZW3prFhiTf1aeDCX/lkXod3nSuWXO4pRwy4pfB2MedQLfEWkIPle4ojis= Received: by 10.64.184.14 with SMTP id h14mr1040251qbf.1168366469683; Tue, 09 Jan 2007 10:14:29 -0800 (PST) Received: by 10.64.153.1 with HTTP; Tue, 9 Jan 2007 10:14:29 -0800 (PST) Message-ID: <51d555c70701091014n6f6874ocdb08fdeb383213e@mail.gmail.com> Date: Tue, 9 Jan 2007 11:14:29 -0700 From: "Rana Dasgupta" To: dev@harmony.apache.org Subject: Re: [drlvm] stress.Mix / MegaSpawn threading bug In-Reply-To: <4dd1f3f00701090751w23e9e3b5pcef55055f201544e@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_105539_25556795.1168366469635" References: <97EB9EC8-ECCD-4E9A-A165-F16310C37133@pobox.com> <4dd1f3f00701090751w23e9e3b5pcef55055f201544e@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_105539_25556795.1168366469635 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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, 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! 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 real app would be able to do anything more at this point. 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. Thanks, Rana ------=_Part_105539_25556795.1168366469635--