Forum: NGINX using upstream in access phase and problem when having many connections

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Huy Phan (Guest)
on 2009-03-10 11:56
(Received via mailing list)
Hi there,
I've done the nginx module that using upstream in access phase. It's
working
properly with single request. When I use apache benchmark with
requests = 10000 and concurrency = 500, the connection is always broken.
I checked the log and see the message "client closed prematurely
connection,
so upstream connection is closed too while connecting to upstream .... "

This is the log file :
30141#0: *33097 socket 9
30141#0: *33097 epoll add connection: fd:9 ev:80000005
30141#0: *33097 connect to 192.168.0.197:11211, fd:9 #33098
30141#0: *33097 http upstream connect: -2
30141#0: *33097 event timer add: 9: 60000:4022552673
30141#0: timer delta: 0
30141#0: posted events 00000000
30141#0: worker cycle
30141#0: epoll timer: 60000
30141#0: epoll: fd:6 ev:0005 d:08AC3490
30141#0: *33097 http run request: "/v/empty.flv?token=1234"
30141#0: *33097 http upstream check client, write event:0,
"/v/empty.flv"
30141#0: *33097 http upstream recv(): 0 (115: Operation now in progress)
30141#0: *33097 client closed prematurely connection, so upstream
connection is
closed too while connecting to upstream, client: 192.168.0.197, server:
localhost, request: "GET /v/empty.flv?token=1234 HTTP/1.0", upstream:
"memcached://192.168.0.197:11211", host: "192.168.0.197:7777"


The upstream connects to memcached server to authenticate the access.

Is that using upstream in access phase really a problem ? What should I
do in
this case ?
Huy Phan (Guest)
on 2009-03-12 09:33
(Received via mailing list)
Huy Phan <dachuy@...> writes:
> 30141#0: *33097 epoll add connection: fd:9 ev:80000005
> 30141#0: *33097 http upstream recv(): 0 (115: Operation now in progress)
>
Hi again,
after doing some debug and check the log again, I see the lines

2009/03/12 13:48:51 [notice] 29606#0: signal 17 (SIGCHLD) received
2009/03/12 13:48:51 [alert] 29606#0: worker process 29607 exited on
signal 11

instead of "close http connection " in the log. May be it's the reason ?

About my module, I call ngx_http_handler(r) again in the function
finalize_request of upstream, I think it can be one of the problem, too.
 But I don't know where else to callback the ngx_http_handler after
getting
the value from upstream.

I'm almost pulling my hair for this :(
This topic is locked and can not be replied to.