Title: os.system behaves differently in Jython 2.5.2 than in 2.2.1
Type: behaviour Severity: critical
Components: Library Versions: Jython 2.5
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: eeiddne, eolikil, zyasoft
Priority: Keywords:

Created on 2013-10-07.16:11:52 by eeiddne, last changed 2014-06-18.17:45:03 by zyasoft.

msg8145 (view) Author: Donal Duane (eeiddne) Date: 2013-10-07.16:11:51

Not sure if this is a bug yet, so apologies if it is not.
We have upgraded from Jython 2.2.1, to 2.5.2, and we are seeing issues with maaPlugin.

Has this changed between these releases?

The following is a sample script which is failing throwing NullPointer Exception for Jython 2.5.2, but not for 2.2.1:


class NULLpointer:

import os
import re
import string
import time
from import MaaPlugin
from java.lang import *

maaPlugin = MaaPlugin(node)
maaPlugin.putInLog("CACLP from shell /tmp/ "+node)
res=os.system("/tmp/ "+node)
maaPlugin = MaaPlugin(node)


msg8146 (view) Author: Donal Duane (eeiddne) Date: 2013-10-07.16:16:12
From the code snippet, the following returns an exception: 

"os.system("/tmp/ "+node)" of this script.

Has this code changed for Jython 2.5.2?
Is there a way around this?

msg8148 (view) Author: Donal Duane (eeiddne) Date: 2013-10-08.15:16:24
Further addition:

This issue seems to revolve around the way os.system handles return codes in Jython 2.5.2 vs older versions (somewhere between 2.2.0 & 2.5.2 - we have nto tried the intermediary versions)

os.system("/tmp/ "+node)

1st when we run our Java application, it creates a main() thread which internally creates JobManager() thread and which internally creates a ActivityThread() and in that activityThread, we execute the script.

- It seems os.system is not happy with the return code from the sample scrit (which contains some unix commands) so when os.system() call has been executed, activityThread() name has been changed to mainThread()

and if we call maaPlugin(node) command, it is not getting the activityID, because it is out of that thread and it has gone to mainThread()
hence we get a NullPointerException...
msg8152 (view) Author: oliver killian (eolikil) Date: 2013-10-15.14:59:02
2013-09-19 13:40:33,496) DEBUG [MainThread] ( -
(2013-09-19 13:40:33,499) ERROR [MainThread] ( - Couldn't find key in this Thread name!
(2013-09-19 13:40:33,504) ERROR [MainThread] ( - Failed to get Job ID null
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
                at java.lang.reflect.Constructor.newInstance(
                at org.python.core.PyReflectedConstructor.constructProxy(
                at org.python.core.PyReflectedConstructor.__call__(
                at org.python.core.PyObject.__call__(
                at org.python.core.PyMethod.instancemethod___call__(
                at org.python.core.PyMethod.__call__(
                at org.python.core.PyMethod.__call__(
                at org.python.core.Deriveds.dispatch__init__(
                at org.python.core.PyObjectDerived.dispatch__init__(
                at org.python.core.PyType.type___call__(
                at org.python.core.PyType.__call__(
                at org.python.core.PyObject.__call__(
                at org.python.core.PyObject.__call__(
                at org.python.pycode._pyx12.NULLpointer$1(<string>:17)
                at org.python.pycode._pyx12.call_function(<string>)
                at org.python.core.Py.makeClass(
                at org.python.core.Py.makeClass(
                at org.python.pycode._pyx12.f$0(<string>:1)
                at org.python.pycode._pyx12.call_function(<string>)
                at org.python.core.Py.runCode(
                at org.python.core.Py.exec(
                at org.python.util.PythonInterpreter.exec(
msg8153 (view) Author: oliver killian (eolikil) Date: 2013-10-15.20:35:05
could this be a subprocess issue ?  .  I see references to replacing os.system from 2.4
msg8158 (view) Author: oliver killian (eolikil) Date: 2013-10-17.13:40:36
still strugging with this,  have implemented a number of changes,  specifically around calls to os.system.   still hitting a null pointer.
msg8159 (view) Author: oliver killian (eolikil) Date: 2013-10-17.13:52:30
looks like same issue,  has other support cases ,  1868 adn 2098. 
any possible workarounds here,  that do not involve a rollback to 2.2.1
msg8465 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.20:41:09
Can we reproduce by using a script that's not Ericsson specific?

There have been some changes since 2.2 in general around making Jython comply much more with CPython. However, we would not expect a NPE.

Most likely any fix would be against Jython 2.7. If we can reproduce, this should be part of a beta 4 for 2.7.
msg8475 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.21:20:16
Duplicated in #2098, which has some potentially useful content re the Ericsson bug
msg8669 (view) Author: Jim Baker (zyasoft) Date: 2014-06-18.17:45:03
No response from OP so closing out as invalid
Date User Action Args
2014-06-18 17:45:03zyasoftsetstatus: open -> closed
resolution: invalid
messages: + msg8669
2014-05-21 21:20:16zyasoftsetmessages: + msg8475
2014-05-21 20:41:09zyasoftsetnosy: + zyasoft
messages: + msg8465
2013-10-17 13:52:31eolikilsetmessages: + msg8159
components: + Library, - Core
2013-10-17 13:40:37eolikilsetmessages: + msg8158
components: + Core, - Any
2013-10-15 20:35:05eolikilsetmessages: + msg8153
2013-10-15 14:59:03eolikilsettype: crash -> behaviour
messages: + msg8152
components: + Any, - Core
nosy: + eolikil
2013-10-08 15:16:25eeiddnesetmessages: + msg8148
2013-10-08 14:51:21eeiddnesettitle: maaPlugin differs in Jython 2.5.2 from 2.2.1 -> os.system behaves differently in Jython 2.5.2 than in 2.2.1
2013-10-07 16:16:12eeiddnesetmessages: + msg8146
2013-10-07 16:11:52eeiddnecreate