java crashes in python thread

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Easeway

    #1

    java crashes in python thread

    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(thre ading.Thread) :

    def __init__(self, shellcmd) :
    threading.Threa d.__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(Th readTask(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()

  • Peter Hansen

    #2
    Re: java crashes in python thread

    Easeway wrote:[color=blue]
    > I use os.system invoking java VM, when running in python thread,
    > the java application crashes.[/color]

    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

    Comment

    • Dieter Maurer

      #3
      Re: java crashes in python thread

      Easeway wrote:[color=blue]
      > I use os.system invoking java VM, when running in python thread, the
      > java application crashes.[/color]

      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

      Comment

      Working...