douyou3619 2015-11-12 14:24
浏览 98

连接中断的可能原因,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'

  • 写回答

1条回答 默认 最新

  • dourang6423 2015-11-30 13:42
    关注

    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".

    评论

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥15 如何修改pca中的feature函数
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况