I have an application written in C ++ that uses opencv 2.0, curl and the opensurf library. First, the PHP script (cron.php) calls proc_open and calls the C ++ application (called icomparer). When it finishes processing, N images returns groups saying which images are the same, after which the script uses:
shell_exec('php cron.php > /dev/null 2>&1 &'); die;
And it starts again. Well, after 800 or 900 repetitions, my icomparer starts to break. The system does not allow me to create more files in icomparer and in php script.
proc_open(): unable to create pipe Too many open files (2) shell_exec(): Unable to execute 'php cron.php > /dev/null 2>&1 &'
And twisting doesn't work either:
couldn't resolve host name (6)
Everything is failing. I think that I am doing something wrong, for example, I donβt know if another PHP process is starting from the release resources of PHP processes.
In "icomparer" I close all open files. Maybe not releasing all the mutexes with mutex_destroy ... but in each iterator the C ++ application is closed, I think all things are released correctly?
What should I look for? I tried to control open files using stof.
- Php 5.2
- Centos 5.X
- 1 GB RAM
- 120 GB hard drive (4% used)
- 4 x intel xeon
- Is VPS (the machine has 16 GB of RAM).
- The process opens 10 threads and combines them.
source share