Соединение было сброшено [aio] [FreeBSD]

Igor Sysoev is at rambler-co.ru
Wed Sep 9 12:38:06 MSD 2009


On Wed, Sep 09, 2009 at 02:10:27AM +0400, Alexey Ivanov wrote:

> Всё работает отлично, но вот появилась проблема с длинными ответами от php и aio:
> Есть страничка - Админка форума, список разделов, разделов таких много, так что страница отдаваемая от php-fpm занимает где-то 1Mb, при этом мгновенно загружается только 292Kb и всё.... через некоторое время выскакивает ошибка "Соединение было сброшено".
> Отключение aio решает проблему
> При том не-html файлы отдаются нормально.

В error_log что-нибудь есть во время этих ошибок ?
Попробуйте прилагаемый патч.


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/os/unix/ngx_freebsd_sendfile_chain.c
===================================================================
--- src/os/unix/ngx_freebsd_sendfile_chain.c	(revision 2399)
+++ src/os/unix/ngx_freebsd_sendfile_chain.c	(revision 2430)
@@ -295,14 +295,13 @@
 
                 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err,
                                "sendfile() sent only %O bytes", sent);
-            }
 
             /*
              * sendfile() in FreeBSD 3.x-4.x may return value >= 0
              * on success, although only 0 is documented
              */
 
-            if (rc >= 0 && sent == 0) {
+            } else if (rc >= 0 && sent == 0) {
 
                 /*
                  * if rc is OK and sent equal to zero, then someone
@@ -311,8 +310,8 @@
                  */
 
                 ngx_log_error(NGX_LOG_ALERT, c->log, 0,
-                              "sendfile() reported that \"%s\" was truncated",
-                              file->file->name.data);
+                         "sendfile() reported that \"%s\" was truncated at %O",
+                         file->file->name.data, file->file_pos);
 
                 return NGX_CHAIN_ERROR;
             }
Index: src/http/ngx_http_request.h
===================================================================
--- src/http/ngx_http_request.h	(revision 2399)
+++ src/http/ngx_http_request.h	(revision 2430)
@@ -547,7 +547,7 @@
 typedef struct {
     ngx_http_posted_request_t         terminal_posted_request;
 #if (NGX_HAVE_AIO_SENDFILE)
-    u_char                            preload[4];
+    u_char                            aio_preload;
 #endif
 } ngx_http_ephemeral_t;
 
Index: src/http/ngx_http_copy_filter_module.c
===================================================================
--- src/http/ngx_http_copy_filter_module.c	(revision 2399)
+++ src/http/ngx_http_copy_filter_module.c	(revision 2430)
@@ -171,9 +171,10 @@
             c->busy_sendfile = NULL;
             e = (ngx_http_ephemeral_t *) &r->uri_start;
 
-            n = ngx_file_aio_read(file, e->preload, 4, offset, r->pool);
+            n = ngx_file_aio_read(file, &e->aio_preload, 1, offset, r->pool);
 
             if (n > 0) {
+                in = NULL;
                 continue;
             }
 


More information about the nginx-ru mailing list