Igor Sysoev ha scritto:
On Tue, Oct 23, 2007 at 11:29:41AM +0200, Manlio Perillo wrote:
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":
while (rc == NGX_AGAIN && !ngx_quit && !ngx_terminate);
There is still a problem with a:
[crit] 19816#0: *1 writev() failed (14: Bad address), client: 10.0.0.10,
server: localhost, URL: "/wsgi-write/", host: "localdomain:1234"
The problem may be caused by the memory buffer (owned by Python) being
deallocated when the write function returns and nginx still continues to
write the data.
I have "patched" the code with a:
if (ngx_quit || ngx_terminate) {
b->pos = 0;
b->last = 0;
b->last_buf = 0;
b->memory = 0;
return NULL;
}