21 messages in ru.sysoev.nginxRe: [dev] synchronous write
FromSent OnAttachments
Manlio PerilloOct 16, 2007 3:32 am 
Igor SysoevOct 16, 2007 11:53 am 
Manlio PerilloOct 16, 2007 12:32 pm 
Igor SysoevOct 16, 2007 12:49 pm 
Manlio PerilloOct 16, 2007 12:56 pm 
Igor SysoevOct 16, 2007 1:00 pm 
Manlio PerilloOct 16, 2007 1:16 pm 
Manlio PerilloOct 21, 2007 2:57 am 
Igor SysoevOct 22, 2007 3:04 am 
Manlio PerilloOct 22, 2007 3:17 am 
Igor SysoevOct 22, 2007 3:39 am 
Manlio PerilloOct 22, 2007 4:10 am 
Igor SysoevOct 22, 2007 4:23 am 
Manlio PerilloOct 22, 2007 4:40 am 
Manlio PerilloOct 22, 2007 12:41 pm 
Manlio PerilloOct 22, 2007 12:48 pm 
Igor SysoevOct 23, 2007 12:10 am 
Igor SysoevOct 23, 2007 12:18 am 
Manlio PerilloOct 23, 2007 2:29 am 
Igor SysoevOct 23, 2007 2:32 am 
Manlio PerilloOct 23, 2007 3:51 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [dev] synchronous writeActions...
From:Manlio Perillo (manl@public.gmane.org)
Date:Oct 23, 2007 2:29:18 am
List:ru.sysoev.nginx

Igor Sysoev ha scritto:

[...]

The loop should be:

do { rc = ngx_http_output_filter(self->r, &out);

self->r->connection->write->ready = 1;

} while (rc == NGX_AGAIN);

In usual processing event->ready is set by event module (kqueue/epoll/etc).

Ok, this solves the problem, thanks! Now ngx_http_output_filter returns NGX_ERROR when the client closes the connection.

There is only one minor problem. When I send a SIGINT signal to nginx during a blocking write operation, the termination is not "clean":

[notice] 12546#0: using the "epoll" event method [notice] 12546#0: nginx/0.5.31 [notice] 12546#0: built by gcc 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) [notice] 12546#0: OS: Linux 2.6.18-5-686 [notice] 12546#0: sysctl(KERN_RTSIGMAX): 0 [notice] 12546#0: getrlimit(RLIMIT_NOFILE): 1024:1024 [notice] 12546#0: start worker processes [notice] 12546#0: start worker process 12548 [notice] 12546#0: start worker process 12549 [debug] 12548#0: *1 wsgi_handler [debug] 12548#0: *1 mod_wsgi: Loading WSGI script '/usr/local/nginx/nginx-write.py' [debug] 12548#0: *1 mod_wsgi: start_response called [debug] 12548#0: *1 mod_wsgi: sent headers, 0 [debug] 12548#0: *1 mod_wsgi: write called 128000000 0 [notice] 12549#0: signal 2 (SIGINT) received, exiting [info] 12549#0: epoll_wait() failed (4: Interrupted system call) [notice] 12549#0: exiting [notice] 12548#0: signal 2 (SIGINT) received, exiting [notice] 12546#0: signal 17 (SIGCHLD) received [notice] 12546#0: worker process 12549 exited with code 0 [notice] 12546#0: signal 2 (SIGINT) received, exiting [notice] 12546#0: signal 29 (SIGIO) received [notice] 12546#0: signal 14 (SIGALRM) received [notice] 12546#0: signal 14 (SIGALRM) received [notice] 12546#0: signal 14 (SIGALRM) received [notice] 12546#0: signal 14 (SIGALRM) received [notice] 12546#0: signal 17 (SIGCHLD) received [alert] 12546#0: worker process 12548 exited on signal 9 [notice] 12546#0: exit

Not a big problem, however.