Mercurial > hg > nginx
comparison src/core/ngx_output_chain.c @ 6423:c5f81dcf97a7
Copy filter: fixed sendfile aio handlers to set ctx->aio.
Sendfile handlers (aio preload and thread handler) are called within
ctx->output_filter() in ngx_output_chain(), and hence ctx->aio cannot
be set directly in ngx_output_chain(). Meanwhile, it must be set to
make sure loop within ngx_output_chain() will be properly terminated.
There are no known cases that trigger the problem, though in theory
something like aio + sub filter (something that needs body in memory,
and can also free some memory buffers) + sendfile can result in
"task already active" and "second aio post" alerts.
The fix is to set ctx->aio in ngx_http_copy_aio_sendfile_preload()
and ngx_http_copy_thread_handler().
For consistency, ctx->aio is no longer set explicitly in
ngx_output_chain_copy_buf(), as it's now done in
ngx_http_copy_thread_handler().
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 03 Mar 2016 21:14:19 +0300 |
parents | 66176dfea01e |
children | 9fd738b85fad |
comparison
equal
deleted
inserted
replaced
6422:768e287a6f36 | 6423:c5f81dcf97a7 |
---|---|
579 #if (NGX_THREADS) | 579 #if (NGX_THREADS) |
580 if (src->file->thread_handler) { | 580 if (src->file->thread_handler) { |
581 n = ngx_thread_read(&ctx->thread_task, src->file, dst->pos, | 581 n = ngx_thread_read(&ctx->thread_task, src->file, dst->pos, |
582 (size_t) size, src->file_pos, ctx->pool); | 582 (size_t) size, src->file_pos, ctx->pool); |
583 if (n == NGX_AGAIN) { | 583 if (n == NGX_AGAIN) { |
584 ctx->aio = 1; | |
585 return NGX_AGAIN; | 584 return NGX_AGAIN; |
586 } | 585 } |
587 | 586 |
588 } else | 587 } else |
589 #endif | 588 #endif |