Bug #74900 [Opn->Fbk]: Random file not found on multiple processes

From: Date: Wed, 12 Jul 2017 16:21:45 +0000
Subject: Bug #74900 [Opn->Fbk]: Random file not found on multiple processes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210024@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74900&edit=1 ID: 74900 Updated by: ab@php.net Reported by: falk dot aaron85 at gmail dot com Summary: Random file not found on multiple processes -Status: Open +Status: Feedback Type: Bug Package: *Directory/Filesystem functions Operating System: Windows Server 2012 R2 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Still no luck. I've changed your code to a bit shorter version <?php ini_set('display_errors', 1); error_reporting( E_ALL ); $path = 'C:\path\to\file'; for ($i = 0; $i < 100; $i++) { if (!file_exists($path)) { die("Doesn't exist"); } if (!file_get_contents($path)) { die("No content"); } } echo "all clean"; and used up to 32 processes, but all i get is "all clean" outputs. You told you've used other PHP versions, have you tried latest versions or just some? Also, does this reproduce on another machine? Thanks. Previous Comments: ------------------------------------------------------------------------ [2017-07-12 16:01:30] falk dot aaron85 at gmail dot com No, i use a absolute path like C:/file.zip. The path in the script.is an absolute path for unix systems. I am able fto reproduce the problem on windows systems with different php versions. You could maybe try to increase the size of the for loop and the amount of php processes started in parallel. ------------------------------------------------------------------------ [2017-07-12 15:57:52] ab@php.net Thanks for the report. I don't reproduce this locally using your PS script. Also, from the PHP supplied - if a path like /path/to/file.zi is used, that might be the issue. If such a path indeed is used, please switch to an absolute path and try again. Thanks. ------------------------------------------------------------------------ [2017-07-11 12:32:16] falk dot aaron85 at gmail dot com Description: ------------ I'm using php 7.0.9NTSx64 on a IIS 8.5 (Windows 2012 R2) to provide a TYPO3 website. Unfortunately, randomly occurs a "No such file or directory" error on calling file_get_contents() for a local static file (e.g. svg images). Before the file_get_contents() call a file_exists() call is executed to verify that the file exists and it does indeed: I can reproduce the error by clearing the backend caches of TYPO3 and then opening 40 tabs of the List menu. In the frontend the error occurs randomly, maybe when multiple clients are using the website, but i cannot reproduce it. Another strange thing is, that when i clear the application pool on IIS, the error will not occur for a few hours. I already tried to use different PHP versions (5.x-7.x with and without fastCGI), disabling symbolic links, ... but nothing resolved the problem. The error only occurs under Windows machines, not under Linux or MacOS. You're also able to reproduce it in shell. Test script: --------------- 1..5 | ForEach-Object { Start-Job { c:\phptest\php-ts\php.exe -f c:\phptest\test.php } } | Out-Null Get-Job | Receive-Job Get-Job | Remove-Job -Force <?php ini_set('display_errors', 1); error_reporting( E_ALL ); $path = '/path/to/file.zip'; for ($i = 0; $i < 100; $i++) { echo "File Exists" . PHP_EOL; var_dump(file_exists($path)); echo "FileSize".PHP_EOL; var_dump(filesize($path)); echo "RealPath".PHP_EOL; var_dump(realpath($path)); echo "FileGetContents".PHP_EOL; var_dump(strlen(file_get_contents($path))); echo "Fopen".PHP_EOL; var_dump(fopen($path, 'rb')); echo PHP_EOL . PHP_EOL; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74900&edit=1

« previous php.bugs (#210024) next »