Hi again,
Don't know if anyone cares or not ;)
Using PythonThread in stead of threading.Thread I can write
Cherrypy applications to my hearts content.... as long as I don't
try to utilize PyLucene in any way.
When calling a PyLucene enabled method I get an output which to my
eyes seems... inconsistent:
---
[EMAIL PROTECTED] LuceneSearch]# python LuceneSearch.py
<snip>Cherrypy startup output</snip>
.
2005/07/27 12:46:38 HTTP INFO Serving HTTP on http://localhost:10007/
Horray ! I,m using PythonThreadWSGIServer!!!!
2005/07/27 12:46:40 HTTP INFO 192.168.1.101 - GET /search/?
sort=2&query=wenger&index=30&indexpath=/opt/index/multiindex HTTP/1.1
GC Warning: Out of Memory! Returning NIL!
2005/07/27 12:46:40 HTTP INFO 192.168.1.101 - GET /favicon.ico
HTTP/1.1
2005/07/27 12:46:41 HTTP INFO 192.168.1.101 - GET /search/?
sort=2&query=wenger&index=30&indexpath=/opt/index/multiindex HTTP/1.1
GC Warning: Out of Memory! Returning NIL!
Aborted
[EMAIL PROTECTED] LuceneSearch]# python LuceneSearch.py
<snip>Cherrypy startup output</snip>
.
2005/07/27 12:46:43 HTTP INFO Serving HTTP on http://localhost:10007/
I,m using PythonThreadWSGIServer!!!!
2005/07/27 12:46:45 HTTP INFO 192.168.1.101 - GET /search/?
sort=2&query=wenger&index=30&indexpath=/opt/index/multiindex HTTP/1.1
2005/07/27 12:46:45 HTTP INFO 192.168.1.101 - GET /favicon.ico
HTTP/1.1
2005/07/27 12:46:46 HTTP INFO 192.168.1.101 - GET /search/?
sort=2&query=wenger&index=30&indexpath=/opt/index/multiindex HTTP/1.1
Traceback (most recent call last):
File "LuceneSearch.py", line 122, in ?
cherrypy.server.start(serverClass=LuceneWSGIServer)
File "/var/www/html/LuceneSearch/cherrypy/server.py", line 61, in
start
_start(initOnly, serverClass)
File "/var/www/html/LuceneSearch/cherrypy/server.py", line 118, in
_start
run_server(serverClass)
File "/var/www/html/LuceneSearch/cherrypy/server.py", line 164, in
run_server
cherrypy._httpserver.start()
File "/var/www/html/LuceneSearch/PythonThreadWSGIServer.py", line
200, in start
self.tick()
File "/var/www/html/LuceneSearch/PythonThreadWSGIServer.py", line
219, in tick
s, addr = self.socket.accept()
File "/usr/local/lib/python2.4/socket.py", line 169, in accept
sock, addr = self._sock.accept()
socket.error: (11, 'Resource temporarily unavailable')
Killed
---
As you can se the first request resulted in a Memory Error, the
second request resulted in a Memory error and then Abort. After
restarting the server, the third request actually made it(!), and
the forurth request resultet in a socket.error...
I feel like Manuel in Fawlty Towers at the moment :)
best regards
/rune
On 26. jul. 2005, at 23.43, Rune Hansen wrote:
Hi Andi,
Thanks. I should've remembered this from my last interaction with
PyLucene threads. Wasn't hard to replace threading.Thread in
Cherrypy WSGIServer to get a "working" PythonThread server.
However my old _friend_ GC Warning: Out of Memory! Returning NIL!
has reared it's ugly head. If my memory serves me correctly (I' ve
cheated and looked at my earlier posts to the list), I had this
exact problem the last time I worked with PyLucene threads. Is
this error to be expected? I'm running the searcher on RHES3.x
Linux with the pre-built PyLucene 1.0 binaries. Last time I tried
I never got Linux working, but OS X worked like a charm.
best regards
/rune
On 26. jul. 2005, at 22.01, Andi Vajda wrote:
If you are using threads, you must use a PyLucene.PythonThread or
else the process will crash really fast, as soon as libgcj
allocates any memory, because the garbage collector won't know
about the thread.
I don't know anything about Cherrypy but there is probably a way
to rework its threading code to use PyLucene.PythonThread (a
subclass of python's threading.Thread class).
Andi..
On Tue, 26 Jul 2005, Rune Hansen wrote:
Hi,
I'm trying to move a PyLucene searcher that works when
implemented in mod_python to Cherrypy(svn498). Unfortunately all
I've managed to get so far is a Segmentation fault. The main
difference is that mod_python forks and Cherrypy uses threads, I
guess that's what's causing the Segfault. I've so far been
completely unable to sneak in a PyLucene.PythonThread anywhere
in the code and make it work.
Anyway, the Segfault seems to happen when a Cherrypy request
thread tries to create a FSDirectory.getDirectory(..
import os
os.environ['GCJ_PROPERTIES'] ="disableLuceneLocks=true"
import cherrypy
from PyLucene import *
class LuceneSeach(object):
def __init__(self,...
.
@cherrypy.expose
def index(self,..
.
@cherrypy.expose
def search(self,indexpath,...
directory = PyLucene.FSDirectory.getDirectory (indexpath,False)
.
if __name__ == "__main__":
cherrypy.root = LuceneSearch()
cherrypy.config.update(..
cherrypy.server.start()
I'd appreciate any help or suggestions.
best regards
/rune
Happy those, who can remain at Highbury!
Jane Austen