简体   繁体   中英

What does this php return code (-11) mean (subprocess.call'ed from python)?

The short version

I want to, in python, s ubprocess.call(['php', '/path/somescript.php']) , the first line of the php script is basically "echo 'Here!';" . But the subprocess.call returns an error code of -11 , and the php script does not get to execute its first line and echo anything to the output. This is all happening on an Ubuntu Server 12.04.2 and a Ubuntu Desktop 12.04.2.

Can anybody point me in the direction of what the -11 return code might mean? (Is it coming from python, the system, or the php command?

A couple of times, I've seen it run deep into the php script and then fail by printing "zend_mm_heap corrupted" and returning 1 .

The more descriptive version of the question:

I have a python script that, after running some phpunit tests using subprocess.call(['phpunit', ...]) , wants to run another php script to collect the code coverage data gathered while running the tests, by doing subprocess.call(['php', '/path/coverage_collector.php']) .

For months, the script worked fine, but today, after adding a couple more files & tests, it started failing (not a 100% of the time, about 5-10% of times it works).

When it fails, subprocess.call returns -11 , and the first line of coverage_collector.php has not managed to echo its message to stdout. A couple of times it ran deeper into the php script, and failed with error code 1 and printed "zend_mm_heap corrupted" .

I have a directory structure where each folder may contain subfolders, each folder gets its unit tests executed, and then coverage data is collected for that folder + its subfolders.

The script works fine on all the folders and their subfolders (executing all the tests & collecting all of the coverage), and used to work fine on the root level folder too (and is currently working fine for a lot of smaller projects with the same exact structure and scripts) - until today, after it started failing after an innocent enough code checkin, that added some files and tests to one of the php projects using the script.

The weird thing is that it's failing in this weird spot - while trying to call a php command, without even getting to execute the first line of the php script, and this happens just seconds after the same php script has been executed for a number of other folders and worked fine.

I'm suspecting it might be due to the fact that the root level script simply has more data to process - combining its own coverage with that of all of the subfolders (which might explain the zend heap corruption, when that occurs), but that still does not explain why the majority of times the call fails with -11 , and does not let the php script even start working on the collecting the coverage data.

Any ideas?

Seems to have been caused by too much coverage data exhausting PHP_CodeCoverage_Report_HTML. No idea why the php scripts output was suppressed making me believe the script never got running.

After asking for more memory using ini_set('memory_limit', '2048M'); in the start of the php script, the success rate went up dramatically (5/6 successful builds so far).

I guess I'll need to play around with memory management in php/zend to properly handle this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM