php - C++ application collapsing after some hours -


i have application written in c++ uses opencv 2.0, curl , opensurf library. first php script (cron.php) calls proc_open , calls c++ application (called icomparer). when finishes processing n images returns groups saying images same, after script uses:

shell_exec('php cron.php > /dev/null 2>&1 &');   die; 

and starts again. well, after 800 or 900 iterates icomparer starts breaking. system don't lets me create more files, in icomparer , in php script.

proc_open(): unable create pipe many open files (2) shell_exec(): unable execute 'php cron.php > /dev/null 2>&1 &' 

and curl fails too:

couldn't resolve host name (6) 

everything crashes. think i'm doing wrong, example, dunno if starting php process php process release resources.

in "icomparer" i'm closing opened files. maybe not releasing mutex mutex_destroy... in each iterator c++ application closed, think stuff released right?

what have watch for? have tried monitoring opened files stof.


  • php 5.2
  • centos 5.x
  • 1 gb ram
  • 120 gb hard disk (4% used)
  • 4 x intel xeon
  • is vps (machine has 16 gb ram)
  • the process opens 10 threads , joins them.

on unix-alike systems, child processes inherit open file descriptors of parent. however, when child process exits, close of copies of open file descriptors not parent's copies.

so opening file descriptors in parent , not closing them. bet not closing pipes returned proc_open() call.

and you'll need call proc_close() too.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -