-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Hi,
I have found and read these issues #8629 and #7078 and I experience the same problems still.
It is a Windows issue - I have a synchronization cli application using symfony/console and symfony/process launching around 4-5K processes a day. It was built and tested on linux and deployed on Windows 2008 Server R2 for production.
The main application is launched by Windows Task Scheduler and using an internal cron-like procedure it launches processes at certain times to sync data between servers.
It worked for a few months then it stopped and was unable to launch even manually.
Looking into the thing and debugging the main process I have found that I was getting this 'A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable.' exception. I looked up the TEMP directory and I have found around 120,000 temporary files inside (most of them 0 bytes).
Looking for the origin I was thrown off-track because I the Process::STDOUT => tempnam(sys_get_temp_dir(), 'out_sf_proc'),
here should produce temporary files with prefix 'out_sf_proc'. Well, it does not. At least not on my server. The files I find that get created by WindowsPipes class are prefixed with: 'out' and 'err' such as 'err4F18.tmp' and 'out4F19.tmp'.
I put in some 'echo's for a quick check to see what gets called and what not.
The __destruct
method gets correctly called, and hence, the removeFiles
method as well.
However, the @unlink($filename);
here does not always succeed resulting in the leftover files.
I have also put in a stupid loop to attempt to remove the file once every second until it succeeds (max 60sec) and I can see that some of the files after 5-10 attempts get correctly removed. Some others reach 60 sec and remain forever. During that time if I attempt to remove these file manually with admin account Windows says that files are in use and cannot be removed.
Any ideas?
Php: 5.6