[pylucene-dev] Re[2]: CORBA multithread issue

Andi Vajda vajda at osafoundation.org
Sun Feb 6 15:36:24 PST 2005


> for f in d.fields():
>    print f
>
> I receive buzz from this "for". It never returns program execution
> from cycle. Actually it prints out as many fields as it has but I
> suppose it tries to get next item after the last item...

The way a python iterator terminates is via a StopIteration exception. I 
suspect that the exception is not being propagated from the server back to the
client if the enumeration is happening over the wire.

How to debug this otherwise ?
It's all open source, right ? so get into the code of the CORBA client and 
server, turn on logging if there is, a take it one step at a time.

Andi..

>
> This happens only under CORBA thread. If I do this in the pure Python
> then everything okay.
> I have no clue how to narrow this bug or get closer to solution how to
> avid it or fix it.. What do you suggest? I know
> that is very hard to give advice on distance. I can try to narrow this
> bug or continue my investigations, if you know how.
>
> Thank you.
>
> AV> PyLucene.PythonThread is a subclass of Python's threading.Thread that
> AV> delegates the creation of the actual OS thread to libgcj. Wherever you see
> AV> threading.Thread used replace that with
> AV> PyLucene.PythonThread, that's all you
> AV> should be having to do.
> AV> We've done the same in Chandler where we use Twisted.
>
> AV>   class WorkerThread(PyLucene.PythonThread):
>
> AV> Andi..
>
> AV> On Sun, 6 Feb 2005, Yura Smolsky wrote:
>
>>> Hello, Andi.
>>>
>>> I hope you will help me with one issue. Here is situation:
>>>
>>> I have CORBA object which is called Server. This server contains
>>> instance of IndexSearcher class. When somebody wants to call some
>>> method of this server then CORBA creates separate thread for each
>>> call. Every method of server work with IndexSearcher object.
>>>
>>> So, we have some multi thread environment which operates with
>>> IndexSearcher object.
>>>
>>> CORBA creates threads using threading.Thread.
>>> I guess, I need to replace threading.Thread with PythonThread threads.
>>> Right?
>>>
>>> I attached code with creating of CORBA threads:
>>>
>>> _thr_init = threading.Thread.__init__
>>> _thr_id   = threading._get_ident
>>> _thr_act  = threading._active
>>> _thr_acq  = threading._active_limbo_lock.acquire
>>> _thr_rel  = threading._active_limbo_lock.release
>>>
>>> class WorkerThread(threading.Thread):
>>>
>>> I think everything is clear, but it is only for my mind. Maybe you
>>> will find a trap there. Please check it and answer can I just replace
>>> threading.Thread with PyLucene.PythonThread?
>>> Do I need to fix more code than just this replacement?
>>>
>>> BIG thanks :)
>>>
>>> Yura Smolsky
>>>
>
>
>
> AV>
>
>
>
> Yura Smolsky,
>
>
>
>


More information about the pylucene-dev mailing list