Hi David,
Thanks for pointing out jToolkit. It looks a bit involved, but I might take a look at it if this PythonThread debacle persist.

regards
/rune

On 27. jul. 2005, at 18.05, David Fraser wrote:

Hi Rune

If you search the archives of the list for David Moore's description of what we do to handle threading on mod_python, you may find that this approach works too for your problem...
Basically we run the PyLucene server out of process...
In fact all the code to do this is in jToolkit which is GPL so you can have a look (jtoolkit.sf.net, the latest version is 0.7 and the code is in jToolkit/data/indexer.py)

David

Rune Hansen wrote:


Hi Andi,
Ok. I've compiled PyLucene with gcc3.4.3 and swig 1.3.23.(I manually removed the binary files from /usr/local/lib and $PYLIB/ site-packages before make install) I see the same inconsistent behavior, as previously described, on RHES3.x Linux / Python 2.4.1

I copied my Cherrypy application to OS X 10.4.3, installed the pre- built binaries from your site and the app just works. Horray for OSX, buhu Linux.

As mentioned, I've posted the same problem to the list before (27. august 2004) when mod_python "solved" the problem by not requiring threads.

On a lighter note, maybe I could convince my boss to let me replace all our Linux boxes with XServe...hmmmm...

btw. I really enjoyed your presentation at EuroPython.

regards
/rune

On 27. jul. 2005, at 13.52, Andi Vajda wrote:



You had said earlier that this was working fine on OS X but not on Linux. What version of gcj are you using on Linux. Maybe you hit a bug there. Did you build PyLucene yourself or you using the binaries built for Linux on Gentoo that I upload ? If the latter and your Linux is not that one, I'd strongly recommend in building your own binaries following the instructions in PyLucene's INSTALL file.

Andi..

On Wed, 27 Jul 2005, Rune Hansen wrote:



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




_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev


Happy those, who can remain at Highbury!
Jane Austen (1775-1817)


_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to