Random fopen error

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Random fopen error

Postby Ag2000 » 25. March 2024 04:22

{Let me preface with PHP may not be the ideal language for this file access heavy application. - This started as a "simple" winter why-not project that has gotten out of hand.}

The objective of the current application is to compare a "new" file with many others to see if it is unique. Running the script hours on end, opens different files to test against thousands of times. Randomly, every other day or less often, the script stops with a error. Today I managed to recover.
/WDMYCLOUD/my/zobrist/Data/step3a/variant_826RHG.txt ADDED as //WDMYCLOUD/my/zobrist/towers/tower_k3fya.txt * * *

Warning: fopen(//WDMYCLOUD/my/zobrist/towers/tower_k3apw.txt): Failed to open stream: Invalid argument in C:\xampp\htdocs\zobrist\duplicate.php on line 30
duplicate #30a: //WDMYCLOUD/my/zobrist/towers/tower_k3apw.txt
//WDMYCLOUD/my/zobrist/Data/step3a/variant_826RHH.txt ADDED as //WDMYCLOUD/my/zobrist/towers/tower_k3fyb.txt * * *

The first and last lines above are normal output from elsewhere.
The related code is:
Image
Code lines #24-28 check that $dir2 and $test_name point to a valid file. The <fopen> on line #30 generated the Warning: this time, BUT after a 5 second delay the similar line #35 worked fine and the script continued to line #44.

Within the error condition the routine towers_added() tries to save the current state to aid recovery.

I'm using Windows 11, FireFox, both current. Locally have XAMMP installed for PHP & mySQL, again current. The //WDMYCLOUD/ is a 6TB hard drive on my LAN. In the PHP.ini file I have increased the "default_socket_timeout" from 60 seconds to 120 with no effect.

Before adding the <sleep(5)> etc., with a Warning the script would go directly to the towers_added() routine, the first <fopen()> in the routine would also create a Warning and then crash when trying to writing to a file. Any ideas? Or am I just stressing Windows with thousands of file operations?
Say what you will about Sisyphus. He always has work.
Ag2000
 
Posts: 14
Joined: 26. November 2023 02:09
XAMPP version: 8.2.12
Operating System: windows 11

Re: Random fopen error

Postby Nobbie » 25. March 2024 18:17

Looks as if //WDMYCLOUD is a NAS, probably (additionally) running a cloud server?!

Anyway, there is full Linux OS running (or similar) and if it is a cloud server, there is a synchronization running all day and night from time to time. Probably the problematic files are currently opened in a system process, which locks the files. Running such scripts on a NAS and Cloud server is a bad idea.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 210 guests