Several requests in one connection

amikish nginx-forum на nginx.us
Ср Ноя 2 09:20:10 UTC 2011


Привет, нужен совет знатоков nginx

Я сделал handler на основе hello world модуля
Получаю там тело HTTP, передаю его в свою
либу, прилинкованную к nginx
Либа возвращает ответ и handler отсылает
HTTP ответ клиенту

Первый запрос обрабатывается
нормально и ответ уходит клиенту
А вот второй запрос в том же соединении
не обрабатывается
После первого запроса worker заходит в
ngx_http_finalize_request, соединение с клиентом не
рветcz
А дальше сваливается в "http reading blocked"
Клиент соответственно блокируется на
чтении ответа на второй запрос

Можно ли обрабатывать несколько
запросов в одном соединении в одном
worker?
Если да, то подскажите плиз как это
можно сделать

Лог воркера получается такой:

2011/11/02 12:50:40 [debug] 3258#0: *2 http process request header line
2011/11/02 12:50:40 [debug] 3258#0: *2 http header: "Host:
127.0.0.1:8080"
2011/11/02 12:50:40 [debug] 3258#0: *2 http header: "Content-type:
text/html"
2011/11/02 12:50:40 [debug] 3258#0: *2 http header: "Content-Length:
578"
2011/11/02 12:50:40 [debug] 3258#0: *2 http header: "Connection:
Keep-Alive"
2011/11/02 12:50:40 [debug] 3258#0: *2 http header: "Cache-Control:
no-cache"
2011/11/02 12:50:40 [debug] 3258#0: *2 http header done
2011/11/02 12:50:40 [debug] 3258#0: *2 event timer del: 9:
1320223897430
2011/11/02 12:50:40 [debug] 3258#0: *2 rewrite phase: 0
2011/11/02 12:50:40 [debug] 3258#0: *2 test location: "/"
2011/11/02 12:50:40 [debug] 3258#0: *2 using configuration "/"
2011/11/02 12:50:40 [debug] 3258#0: *2 http cl:578 max:1048576
2011/11/02 12:50:40 [debug] 3258#0: *2 rewrite phase: 2
2011/11/02 12:50:40 [debug] 3258#0: *2 post rewrite phase: 3
2011/11/02 12:50:40 [debug] 3258#0: *2 generic phase: 4
2011/11/02 12:50:40 [debug] 3258#0: *2 generic phase: 5
2011/11/02 12:50:40 [debug] 3258#0: *2 access phase: 6
2011/11/02 12:50:40 [debug] 3258#0: *2 access phase: 7
2011/11/02 12:50:40 [debug] 3258#0: *2 post access phase: 8
2011/11/02 12:50:40 [debug] 3258#0: *2 http client request body preread
578
2011/11/02 12:50:40 [debug] 3258#0: *2 HTTP/1.1 200 OK
Server: nginx/1.0.8
Date: Wed, 02 Nov 2011 08:50:40 GMT
Content-Type: text/html
Content-Length: 13
Connection: keep-alive

2011/11/02 12:50:40 [debug] 3258#0: *2 write new buf t:1 f:0
0000000001F487F8, pos 0000000001F487F8, size: 146 file: 0, size: 0
2011/11/02 12:50:40 [debug] 3258#0: *2 http write filter: l:0 f:0 s:146
2011/11/02 12:50:40 [debug] 3258#0: *2 http output filter "/?"
2011/11/02 12:50:40 [debug] 3258#0: *2 http copy filter: "/?"
2011/11/02 12:50:40 [debug] 3258#0: *2 http postpone filter "/?"
00007FFFD40FF940
2011/11/02 12:50:40 [debug] 3258#0: *2 write old buf t:1 f:0
0000000001F487F8, pos 0000000001F487F8, size: 146 file: 0, size: 0
2011/11/02 12:50:40 [debug] 3258#0: *2 write new buf t:0 f:0
0000000000000000, pos 0000000000688C88, size: 13 file: 0, size: 0
2011/11/02 12:50:40 [debug] 3258#0: *2 http write filter: l:1 f:0 s:159
2011/11/02 12:50:40 [debug] 3258#0: *2 http write filter limit 0
2011/11/02 12:50:40 [debug] 3258#0: *2 writev: 159
2011/11/02 12:50:40 [debug] 3258#0: *2 http write filter
0000000000000000
2011/11/02 12:50:40 [debug] 3258#0: *2 http copy filter: 0 "/?"
2011/11/02 12:50:40 [debug] 3258#0: *2 http finalize request: 0, "/?"
a:1, c:2
2011/11/02 12:50:40 [debug] 3258#0: *2 http request count:2 blk:0
2011/11/02 12:51:02 [debug] 3258#0: *2 http run request: "/?"
2011/11/02 12:51:02 [debug] 3258#0: *2 http reading blocked

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,217687,217687#msg-217687



Подробная информация о списке рассылки nginx-ru