连接中断的可能原因,LAMP堆栈

MySQL 5.1.73 Apache/2.2.15 PHP 5.6.13 CentOS release 6.5 Cakephp 3.1

After about 4 minutes (3 min, 57 seconds) the import process I'm running stops. There are no errors or warnings in any log that I can find. The import process consists of a lot of SQL calls and data processing, nothing too crazy, but it can take about 10 minutes to get through 5500 records if it's doing a full compare for updates.

Firefox: Secure Connection Failed - The connection to the server was reset while the page was loading. Chrome: ERR_NO RESPONSE

  1. The php set time limit is set to 900, which is working. I can set it to 5 seconds and get an error. The limit is not being reached.
  2. I can sleep another controller for 10 minutes, and this error does not happen, indicating that something in the actual program is causing it to fail, and not the hosting service killing the request because it's taking too long (read about VPS doing this to prevent spam).
  3. The php errors are turned all the way up in the php.ini, and just to be sure, in the controller itself.
  4. The import process completes if I reduce the size of the file being imported. If it's just long enough, it will complete AND show the browser message. This indicates to me it's not failing at the same point of execution each time.
  5. I have deleted all the cache and restarted the server.
  6. I do not see any output in the apache logs other then that the request was made.
  7. I do not see any errors in the mysql log, however, I don't know if it's because its not turned on.
  8. The exact same code works on my local host without any issue. It's not a perfect match to the server, but it's close. Ubuntu Desktop vs Centos, php 5.5 vs php 5.6
  9. I have kept an eye on the memory usage and don't see any issues there.

At this point I'm looking for any good suggestions on what else to look at or insights into what could be causing the failure. There are a lot of possible places to look, and without an error, it's really difficult to narrow down where the issue might be. Thanks in advance for any advice!

UPDATE

After taking a closer look at the memory usage during the request, I noticed it was getting much higher than it ideally should.

The httpd (apache) process gets killed and a new thread spawned. Once the new thread runs out of memory, the error shows up on the screen. When I had looked at it previous, it was only at 30%, probably because it had just killed the old process. Watching it the whole way through, I saw it get as high as 80%, which with the other processes was enough to get have it run out of memory, and a killed process can't log anything, hence the no errors or warnings. It is interesting to me that the process just starts right back up.

I found a command to show which processes had been killed due to memory which proved very useful:

dmesg | egrep -i 'killed process'

I did have similar problems with debugkit. I had bug in my code during memory peak and the context was written to html in the error "log".