Welcome! Log In Create A New Profile

Advanced

Re: nginx-0.8.12

September 07, 2009 06:24PM
On Mon, Aug 31, 2009 at 03:44:53PM +0400, Igor Sysoev wrote:

> Изменения в nginx 0.8.12 31.08.2009
>
> *) Добавление: параметр sendfile в директиве aio во FreeBSD.
>
> *) Исправление: ошибки при использовании try_files; ошибка появилась в
> 0.8.11.
>
> *) Исправление: ошибки при использовании memcached; ошибка появилась в
> 0.8.11.

Патч, исправляющий ошибку в aio sendfile.


--
Игорь Сысоев
http://sysoev.ru
Index: src/http/ngx_http_copy_filter_module.c
===================================================================
--- src/http/ngx_http_copy_filter_module.c (revision 2386)
+++ src/http/ngx_http_copy_filter_module.c (working copy)
@@ -133,55 +133,63 @@
r->request_output = 1;
}

- rc = ngx_output_chain(ctx, in);
+ for ( ;; ) {
+ rc = ngx_output_chain(ctx, in);

- if (ctx->in == NULL) {
- r->buffered &= ~NGX_HTTP_COPY_BUFFERED;
+ if (ctx->in == NULL) {
+ r->buffered &= ~NGX_HTTP_COPY_BUFFERED;

- } else {
- r->buffered |= NGX_HTTP_COPY_BUFFERED;
- }
+ } else {
+ r->buffered |= NGX_HTTP_COPY_BUFFERED;
+ }

- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);
+ ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
+ "http copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);

#if (NGX_HAVE_AIO_SENDFILE)

- if (c->busy_sendfile) {
- off_t offset;
- ngx_file_t *file;
- ngx_http_ephemeral_t *e;
+ if (c->busy_sendfile) {
+ ssize_t n;
+ off_t offset;
+ ngx_file_t *file;
+ ngx_http_ephemeral_t *e;

- file = c->busy_sendfile->file;
- offset = c->busy_sendfile->file_pos;
+ file = c->busy_sendfile->file;
+ offset = c->busy_sendfile->file_pos;

- if (file->aio) {
- c->aio_sendfile = (offset != file->aio->last_offset);
- file->aio->last_offset = offset;
+ if (file->aio) {
+ c->aio_sendfile = (offset != file->aio->last_offset);
+ file->aio->last_offset = offset;

- if (c->aio_sendfile == 0) {
- ngx_log_error(NGX_LOG_ALERT, c->log, 0,
- "sendfile(%V) returned busy again", &file->name);
+ if (c->aio_sendfile == 0) {
+ ngx_log_error(NGX_LOG_ALERT, c->log, 0,
+ "sendfile(%V) returned busy again", &file->name);
+ }
}
- }

- c->busy_sendfile = NULL;
- e = (ngx_http_ephemeral_t *) &r->uri_start;
+ c->busy_sendfile = NULL;
+ e = (ngx_http_ephemeral_t *) &r->uri_start;

- (void) ngx_file_aio_read(file, e->preload, 4, offset, r->pool);
+ n = ngx_file_aio_read(file, e->preload, 4, offset, r->pool);

- if (file->aio) {
- file->aio->data = r;
- file->aio->handler = ngx_http_copy_aio_sendfile_event_handler;
+ if (n > 0) {
+ continue;
+ }

- r->main->blocked++;
- r->aio = 1;
+ rc = n;
+
+ if (file->aio) {
+ file->aio->data = r;
+ file->aio->handler = ngx_http_copy_aio_sendfile_event_handler;
+
+ r->main->blocked++;
+ r->aio = 1;
+ }
}
- }
-
#endif

- return rc;
+ return rc;
+ }
}
Subject Author Posted

Re: nginx-0.8.12

Igor Sysoev September 07, 2009 06:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready