Unusual minidom behaviour: Part Deux

Victor Bazarov vAbazarov at dAnai.com
Sun Jul 29 00:51:03 EDT 2001


"Aahz Maruch" <aahz at panix.com> wrote...
> In article <O4Y77.12077$Up.356569 at sea-read.news.verio.net>,
> Victor Bazarov <vAbazarov at dAnai.com> wrote:
> [...]
> What OS are you using?  Which JVM?

That's happening on Windows 2000, under Java 1.3.

> >In order to write a test program I have to know what to try to
> >reproduce.  Should it itself be multi-threaded?  How complex should
> >it be?  If I don't get the same result, does it mean the problem is
> >in my Java program or is it just a coincidence?  (as I wrote before,
> >it does not happen if I run Java program under the debugger instead
> >of simply executing it)  You see, it would probably take me as long
> >to create a "self-contained" example as it did to create the system
> >in its current state.
>
> You've got a complex problem here, probably resulting from a multi-way
> interaction between Python, Java, and the OS.  You're going to get little
> help from us unless you can pare down the problem.

If I could pare it down, I would have probably found the cause by
now.  The problem is that I don't have time to look.  The system
that Python is running is a fairly complex one.  The Java app that
runs the Python interpreter is also complex.  Call it a hunch, call
it an educated guess, but I have a feeling that as soon as I start
paring the problem by removing some [irrelevant] parts of the app
and the Python code, the problem will go into hiding...

> >One of my colleagues suggested wrapping the call to minidom.parse
> >in a critical section (locking something before, unlocking after),
> >another hint came from you: let the main program sleep after fork.
> >At this point I frankly care only about one thing: to prevent it
> >from happening.
>
> That's one way.  I second Paul's suggestion that you instead do the
> import before you spin off any threads.  Note that the problem in the
> other thread you're referring to was *Python* doing a fork, not Python
> executing in the forked process.

I will certainly try it.

> I think your best bet is likely to be switching to Jython instead of
> trying to run CPython through a system call.  That way, your Python
> program will have full access to Java's capabilities, and you'll have
> better cross-platform portability.  If you stick with CPython, I suggest
> upgrading to Python 2.1.1; IIRC, there were some thread bugs fixed
> post-2.0.

I tried the latest version.  No difference.  As to switching to
Jython, it's not my place to decide, but I will make sure to
suggest it.

Thanks.

Victor
--
Please remove capital A's from my address when replying by mail





More information about the Python-list mailing list