Return-Path: Delivered-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Received: (qmail 48998 invoked from network); 15 Jun 2009 19:27:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jun 2009 19:27:31 -0000 Received: (qmail 5092 invoked by uid 500); 15 Jun 2009 19:27:42 -0000 Delivered-To: apmail-lucene-pylucene-dev-archive@lucene.apache.org Received: (qmail 5069 invoked by uid 500); 15 Jun 2009 19:27:42 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 5059 invoked by uid 99); 15 Jun 2009 19:27:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2009 19:27:42 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 74.55.86.74 is neither permitted nor denied by domain of aric.coady@gmail.com) Received: from [74.55.86.74] (HELO smtp.webfaction.com) (74.55.86.74) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2009 19:27:30 +0000 Received: from [192.168.1.62] (unknown [71.95.209.242]) by smtp.webfaction.com (Postfix) with ESMTP id 14C601C721D1 for ; Mon, 15 Jun 2009 14:27:10 -0500 (CDT) Message-Id: From: Aric Coady To: pylucene-dev@lucene.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: initVM() crash and web.py Date: Mon, 15 Jun 2009 12:27:09 -0700 References: X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org On Jun 15, 2009, at 12:12 PM, Neha Gupta wrote: > The problem am having is that when I send a few requests one after > the other > then the server crashes. I tried to put initVM() right after import > lucene > statement at the top of the program but the crash still happens. I > also read > this post: > http://lists.osafoundation.org/pipermail/pylucene-dev/2008-April/002634.html > . > > The problem seems familiar to mine, however, am not sure where > should I put > initVM(). Should I also be calling env.attachCurrentThread() > somewhere? initVM must be called exactly once, so at the top of the program is a fine place for it. attachCurrentThread must be called at least once per thread. It is idempotent (and fast), so you can put it at the top of your request handler. I prefer putting it in the threading code anyway, instead of cluttering the app. My lupyne project has an example of that: look for WorkerThread in http://code.google.com/p/lupyne/source/browse/trunk/lupyne/server.py . LuPyne uses cherrypy, and web.py uses cherrypy's wsgiserver, so the code will translate.