Message10982

Author andrewparks
Recipients andrewparks, zyasoft
Date 2016-10-30.20:17:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477858638.64.0.136898402297.issue2530@psf.upfronthosting.co.za>
In-reply-to
Content
This is way worse a situation that I'd thought - I'd assumed so far that I could just call thread.interrupt and abort any PythonInterpreter.exec() and then just create new PythonInterpreters and carry on.

This is not the case - after a thread.interrupt(), the whole VM is broken and cannot exec any more python, even if new PythonInterpreters are instantiated!!

Sample code that demonstrates the problem:

    PythonInterpreter pi = new PythonInterpreter();

    Thread jythonThread = new Thread(() -> {
      try {
        pi.exec("while 1: print 'hello'");
      }
      catch (org.python.core.PyException e) {
        PythonInterpreter pi2 = new PythonInterpreter();
        pi2.exec("print 'hello again'"); // THROWS a org.python.core.PyException - WHY?!
      }
    });

    jythonThread.setName("jythonThread");
    jythonThread.start();

    new Thread(() -> {
      try {
        Thread.sleep(500);
        jythonThread.interrupt();
      }
      catch (InterruptedException e) {
        e.printStackTrace();
      }
    }).start();
History
Date User Action Args
2016-10-30 20:17:18andrewparkssetmessageid: <1477858638.64.0.136898402297.issue2530@psf.upfronthosting.co.za>
2016-10-30 20:17:18andrewparkssetrecipients: + andrewparks, zyasoft
2016-10-30 20:17:18andrewparkslinkissue2530 messages
2016-10-30 20:17:17andrewparkscreate