Message10982
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(); |
|
Date |
User |
Action |
Args |
2016-10-30 20:17:18 | andrewparks | set | messageid: <1477858638.64.0.136898402297.issue2530@psf.upfronthosting.co.za> |
2016-10-30 20:17:18 | andrewparks | set | recipients:
+ andrewparks, zyasoft |
2016-10-30 20:17:18 | andrewparks | link | issue2530 messages |
2016-10-30 20:17:17 | andrewparks | create | |
|