[capi-sig] getting popen error after long term use
simon.kiertscher at gmx.de
Thu Sep 8 16:35:36 CEST 2011
I hope I post on the correct list, sorry if not.
I have written a C-daemon and I use the C/Python API for calling bash
commands via python using popen.
My daemon seems to run without errors, but after a unknown period of
time (sometimes the daemon runs a week without problems, sometimes a
month) the program isn't able to run the python scripts any more.
I get the following error:
Exception exceptions.AttributeError: "'Popen' object has no attribute
'_child_created'" in <bound method Popen.__del__ of <subprocess.Popen
object at 0x2aaaaf1fa910>> ignored
I googled the error but didn't get smarter.
So I have no idea if the error is on the python site or on the c site.
And I have no idea why the error occurs after a long time of run. I
would think (because of the unknown time fact) there is a memory leak or
something like that, what else could it be? Has anyone an idea would I
could do wrong?
My c calls look like that:
int shutdown(const char *node_address, struct content *content)
assert(node_address != NULL);
PyObject *funk, *prm, *ret;
funk = PyObject_GetAttrString(content->modul, "shutdown");
if(funk == NULL)
syslog(LOG_ERR, "[MASTER] [shutdown] CANT LOAD SHUTDOWN FROM
prm = Py_BuildValue("(s)", node_address);
if(prm == NULL)
syslog(LOG_ERR, "[MASTER] [shutdown] CANT BUILD VALUE");
ret = PyObject_CallObject(funk, prm);
if(ret == NULL)
syslog(LOG_ERR, "[MASTER] [shutdown] CANT CALL FUNCTION OBJECT");
syslog(LOG_ERR, "[MASTER] [shutdown] ERROR ON PyInt_AsLong");
And my Python calls look like that:
p = subprocess.Popen(["ipmitool","-l", "LAN", "-H",node_address,"-U",
"root", "-P", config.IPMIPassword, "power",
When I kill the daemon after noticing that it can't call he functions
any more, I get the following errors in addition:
Exception exceptions.IndexError: 'list index out of range' in 'garbage
Fatal Python error: unexpected exception during garbage collection
I strongly hope someone has an idea about that.
Sorry for the bad English.
More information about the capi-sig