I need to load multiple files from a database and I am using php to do it.
I am using windows 7 64 bits and xampp and uniserver as servers (xampp 1.8.3-4 VC11 and uniserver XI 11.3.1). Both crashes when I load at the exact same time two php files (they can be the same file with different get variables or different files). I tried with an older version of xampp but happens the same problem.
EDIT: I noticed that it only happens using the browser palemoon (I am using the version 24.7.1 x64). Chrome, Opera and Firefox works well. I don't understand why.
To reproduce it I only need to create a html file index.html with this content:
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="a.php"/>
<link rel="stylesheet" href="b.php"/>
</head>
</html>
Now, create two blank files, one called a.php and the other b.php (it doesn't matter what it is written in them)
Lastly open the html on a browser and do ctrl-f5 until apache crashes.
The only thing apache logs about this is
[Tue Aug 12 04:38:14.576000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00428: Parent: child process 3368 exited with status 3221225477 -- Restarting.
[Tue Aug 12 04:38:14.686000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00455: Apache/2.4.10 (Win32) PHP/5.4.31 configured -- resuming normal operations
[Tue Aug 12 04:38:14.686000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00456: Apache Lounge VC10 Server built: Jul 19 2014 11:02:31
[Tue Aug 12 04:38:14.686000 2014] [core:notice] [pid 3880:tid 148] AH00094: Command line: 'C:\\UniServerZ\\core\\apache2\\bin\\httpd_z.exe -d C:/UniServerZ/core/apache2 -f C:\\UniServerZ\\core\\apache2\\conf\\httpd.conf -d C:\\UniServerZ\\core\\apache2'
[Tue Aug 12 04:38:14.688000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00418: Parent: Created child process 5040
[Tue Aug 12 04:38:15.267000 2014] [mpm_winnt:notice] [pid 5040:tid 568] AH00354: Child: Starting 150 worker threads.
I found this bug report but the last entry is from 2004 so I am wondering if this problem is a bug and, if it is, is the same bug: https://bugs.php.net/bug.php?id=25570
EDIT: Using this C# makes the server crash sometimes
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
class MainClass
{
public static void Main (string[] args)
{
IPAddress ipAddress = Array.FindAll(
Dns.GetHostEntry("127.0.0.1").AddressList,
a => a.AddressFamily == AddressFamily.InterNetwork)[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress,80);
Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
string request = "GET /a.php HTTP/1.1
" +
"Host: 127.0.0.1
" +
"
";
sender.Connect(remoteEP);
sender.Send (Encoding.UTF8.GetBytes (request));
sender.Send (Encoding.UTF8.GetBytes (request));
byte[] buffer = new byte[4096];
int nBytes = 0;
try {
while ((nBytes = sender.Receive(buffer,4096, SocketFlags.None)) > 0)
{
// From byte array to string
string s = Encoding.UTF8.GetString(buffer, 0, nBytes);
Console.WriteLine(s);
}
} catch (SocketException e) {
Console.WriteLine("error {0}", e.ErrorCode);
}
Console.WriteLine("
Press a key...");
Console.ReadKey();
}
}
EDIT: I am using Connection: Close
on the windows xampp server to elude the problem. My linux vps works perfectly, it only happens on the windows server.