﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
776	Hang after NGX_AGAIN	tguyard.wordpress.com		"
I've been trying to develop a filter module.

In some rare cases, `ngx_http_write_filter` return `NGX_AGAIN` (Mostly when using the limit_rate feature). My filter then just return `NGX_AGAIN` and wait to be called again later.
This works well most of the time.

The error occurs when my filter has finished to send all the data (`buf->last_buf = 1;`), and gets a `NGX_AGAIN` from the next filter. I then return `NGX_AGAIN`, but NEVER GET CALLED again.

Maybe I did something wrong, but when trying to fix the problem, I found something that seems weird in the source code:
`ngx_http_finalize_request` does not always reset the `c->write->delayed` value.

After adding `c->write->delayed = 0;` in `ngx_http_finalize_request` on line 2428, the error was fixed. (And everything seems to work ok)



The nginx I use come from the Ubuntu14/04 repository."	defect	closed	minor		nginx-core	1.9.x	fixed	module, filter, delayed, post_action		Linux nginx03 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.8.0
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_spdy_module --with-http_sub_module --add-module=/nginx-1.8.0/debian/modules/nginx-aes-module --add-module=/nginx-1.8.0/debian/modules/nginx-upload-module --add-module=/nginx-1.8.0/debian/modules/ngx_http_substitutions_filter_module
"
