lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aric Coady <>
Subject Re: initVM() crash and
Date Mon, 15 Jun 2009 19:27:09 GMT
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:
> .< 
> >
> 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 
.  LuPyne uses cherrypy, and uses cherrypy's wsgiserver, so the  
code will translate.

View raw message