java crashes in python thread

E

Easeway

I use os.system invoking java VM, when running in python thread,
the java application crashes. But it works properly when thread is
not used.

Has any body come across with this problem?

Python 2.3.3
J2SDK 1.4.2_05
SuSE Linux Enterprise Server 9

The following is source file:
#!/usr/bin/env python

import os, sys, threading

class ThreadTask(threading.Thread) :

def __init__(self, shellcmd) :
threading.Thread.__init__(self)
self.command = shellcmd

def isStopped(self) :
self.join(0.01)
return not self.isAlive()

def run(self) :
os.system(self.command)

def test() :
commands = [
"/usr/lib/java/bin/javac",
"/usr/lib/java/bin/java",
]
tasks = []
for a in commands :
tasks.append(ThreadTask(a))

for a in tasks :
a.start()

endcnt = 0
while endcnt < len(tasks) :
endcnt = 0
for a in tasks :
if a.isStopped() : endcnt += 1
print("DONE")

test()
 
P

Peter Hansen

Easeway said:
I use os.system invoking java VM, when running in python thread,
the java application crashes.

Can you define "crash" more precisely? Isn't there any
kind of error message/traceback that would reveal more
information about the problem?

Also, how quickly do you get this crash? Instantly,
shortly after starting, a long time after starting,
at completion of the Java processes (maybe check to
see whether the entire javac has executed, or some
other sign of completion), or ?

-Peter
 
D

Dieter Maurer

Easeway said:
I use os.system invoking java VM, when running in python thread, the
java application crashes.

Andreas Jung has reported similar behaviour.

He suggested that Java 1.4 and the threads of Linux 2.6
do not work reliably together.
He tried Java 1.5 and this combination crashes only occationally.
But this, it is not yet reliable...

Dieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top