Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4416 - in trunk/src: http os/unix

Anonymous User
January 30, 2012 02:40AM
Author: mdounin
Date: 2012-01-30 07:39:47 +0000 (Mon, 30 Jan 2012)
New Revision: 4416

Log:
Fixed AIO error handling on FreeBSD.

The aio_return() must be called regardless of the error returned by
aio_error(). Not calling it resulted in various problems up to segmentation
faults (as AIO events are level-triggered and were reported again and again).

Additionally, in "aio sendfile" case r->blocked was incremented in case of
error returned from ngx_file_aio_read(), thus causing request hangs.


Modified:
trunk/src/http/ngx_http_copy_filter_module.c
trunk/src/os/unix/ngx_file_aio_read.c

Modified: trunk/src/http/ngx_http_copy_filter_module.c
===================================================================
--- trunk/src/http/ngx_http_copy_filter_module.c 2012-01-30 07:38:27 UTC (rev 4415)
+++ trunk/src/http/ngx_http_copy_filter_module.c 2012-01-30 07:39:47 UTC (rev 4416)
@@ -190,7 +190,7 @@

rc = n;

- if (file->aio) {
+ if (rc == NGX_AGAIN) {
file->aio->data = r;
file->aio->handler = ngx_http_copy_aio_sendfile_event_handler;


Modified: trunk/src/os/unix/ngx_file_aio_read.c
===================================================================
--- trunk/src/os/unix/ngx_file_aio_read.c 2012-01-30 07:38:27 UTC (rev 4415)
+++ trunk/src/os/unix/ngx_file_aio_read.c 2012-01-30 07:39:47 UTC (rev 4416)
@@ -157,24 +157,15 @@
return NGX_ERROR;
}

- if (n != 0) {
- if (n == NGX_EINPROGRESS) {
- if (ev->ready) {
- ev->ready = 0;
- ngx_log_error(NGX_LOG_ALERT, file->log, n,
- "aio_read(\"%V\") still in progress",
- &file->name);
- }
-
- return NGX_AGAIN;
+ if (n == NGX_EINPROGRESS) {
+ if (ev->ready) {
+ ev->ready = 0;
+ ngx_log_error(NGX_LOG_ALERT, file->log, n,
+ "aio_read(\"%V\") still in progress",
+ &file->name);
}

- aio->err = n;
- ev->ready = 0;
-
- ngx_log_error(NGX_LOG_CRIT, file->log, n,
- "aio_read(\"%V\") failed", &file->name);
- return NGX_ERROR;
+ return NGX_AGAIN;
}

n = aio_return(&aio->aiocb);
@@ -182,9 +173,9 @@
if (n == -1) {
err = ngx_errno;
aio->err = err;
- ev->ready = 0;
+ ev->ready = 1;

- ngx_log_error(NGX_LOG_ALERT, file->log, err,
+ ngx_log_error(NGX_LOG_CRIT, file->log, err,
"aio_return(\"%V\") failed", &file->name);
return NGX_ERROR;
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4416 - in trunk/src: http os/unix

Anonymous User 904 January 30, 2012 02:40AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 307
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