免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 26179 | 回复: 5
打印 上一主题 下一主题

[Web] nginx运行异常,“connect() failed (110: Connection timed out)”问题? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-07-27 10:52 |只看该作者 |倒序浏览
本帖最后由 huifeideluotuo 于 2010-07-27 11:10 编辑

配置环境

硬件环境:
CPU:Intel(R) Xeon(R) CPU 3050  @ 2.13GHz
内存:4G       

软件环境:centos5.4 + php5.2.8 + nginx0.8.37

nginx.conf配置文件如下:
  1. user  www www;
  2. worker_processes 2;
  3. worker_rlimit_nofile    51200;

  4. events
  5. {
  6.   use                   epoll;
  7.   worker_connections    51200;
  8. }


  9. http
  10. {
  11.   include                       mime.types;
  12.   default_type                  application/octet-stream;

  13.       
  14.   server_names_hash_bucket_size 256;
  15.   client_header_buffer_size     1024k;
  16.   large_client_header_buffers   4 1024k;
  17.   client_max_body_size          32m;
  18.   client_body_buffer_size       256k;
  19.   client_header_timeout         3m;
  20.   client_body_timeout           3m;
  21.   send_timeout                  3m;
  22.       
  23.   sendfile                      on;
  24.   tcp_nopush                    on;

  25.   keepalive_timeout             60;

  26.   tcp_nodelay                   on;

  27.   fastcgi_intercept_errors      on;

  28.   fastcgi_connect_timeout       500;
  29.   fastcgi_send_timeout          500;
  30.   fastcgi_read_timeout          500;
  31.   fastcgi_buffer_size           1024k;
  32.   fastcgi_buffers               8 1024k;
  33.   fastcgi_busy_buffers_size     1024k;
  34.   fastcgi_temp_file_write_size  1024k;

  35.   gzip                          on;
  36.   gzip_min_length               1k;
  37.   gzip_buffers                  4 16k;
  38.   gzip_http_version             1.0;
  39.   gzip_comp_level               2;
  40.   gzip_types                    text/plain application/x-javascript text/css application/xml;
  41.   gzip_vary                     on;
复制代码
问题现象描述:
nginx在运行时出现一些异常问题,此时静态页面(html)可以打开,但是不能加载动态页面,一直处于等待状态,此时重新启动nginx后恢复正常,查看日志错误内容如下:

2010/07/26 09:59:52 [error] 12929#0: *304919 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.10.4, server: 123.test.cn, request: "GET /index.php?module=default&submod=user_setting&method=user_home_page HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "123.test.cn", referrer: "http://123.test.cn/index.php?method=left&parent_id=121&section_id=default&open_mainframe=1"

2010/07/26 10:03:44 [error] 12930#0: *311831 connect() failed (110: Connection timed out) while connecting to upstream, client: 192.168.10.4, server: 123.test.cn, request: "GET /index.php?method=left&parent_id=3&section_id=customer&open_mainframe=1 HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "123.test.cn", referrer: "http://123.test.cn/index.php?method=top&section_id=&main_url="


也查找了原因,很多朋友也遇到这样的问题,但是没有解决,说是nginx不稳定的原因,如果不稳定,那QQ、迅雷怎么还用呢?

请兄弟们指教,谢谢!

论坛徽章:
0
2 [报告]
发表于 2010-07-30 14:37 |只看该作者
你php部分怎么搞的

论坛徽章:
0
3 [报告]
发表于 2010-07-30 14:37 |只看该作者
你php部分怎么搞的

论坛徽章:
0
4 [报告]
发表于 2010-08-02 15:48 |只看该作者
回复 1# huifeideluotuo


    内核的一个bug,引起gettimeofday()函数返回的时间比当前时间快4398秒, 可以google “gettimeofday 4398"看到一些讨论。跟nginx无关,其实只要用到gettimefoday函数的程序都会有这个风险,压力越大的时候,就越容易出错,并且很容易误认为是压力过大导致处理不过来。

论坛徽章:
0
5 [报告]
发表于 2010-08-10 11:37 |只看该作者
回复  huifeideluotuo


    内核的一个bug,引起gettimeofday()函数返回的时间比当前时间快4398秒, ...
xcue 发表于 2010-08-02 15:48



看来要升级内核了,在网上搜索是有这个问题,,但是没有说是和nginx相关,郁闷中?

论坛徽章:
1
白银圣斗士
日期:2015-11-23 08:33:04
6 [报告]
发表于 2010-09-03 16:52 |只看该作者
到那个内核可以解决这个问题?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP