the http request:
wget -O /tmp/re -S “http://***/setcookie”
–post-data=‘username=liufeng&loginCookie=ayaheiheifn&domain=xxx.com’
the http request sends two packets,and ngx_unix_recv is called two
times.
the first call does work properly,
but the secend call fails:the call to recv returns -1.
if the program sleeps for some time before recv call ,the system works
properly.
who can tell me how to solve this problem
Posted at Nginx Forum:
use strace,the system alert:Resource temporarily unavailable
recv(8, 0x9bfb880, 55, 0) = -1 EAGAIN (Resource
temporarily unavailable)
it appears that recv reads data when the data is not prepared.
it does not check if the data is available
Posted at Nginx Forum:
Hello!
On Thu, Aug 27, 2009 at 04:47:05AM -0400, wangbin579 wrote:
the http request:
wget -O /tmp/re -S “http://***/setcookie” --post-data=‘username=liufeng&loginCookie=ayaheiheifn&domain=xxx.com’
the http request sends two packets,and ngx_unix_recv is called two times.
the first call does work properly,
but the secend call fails:the call to recv returns -1.
if the program sleeps for some time before recv call ,the system works properly.
who can tell me how to solve this problem
First of all - do not use ngx_unix_recv() directly, use ngx_recv()
instead.
Second, is it really returns -1? From your description it looks
like it returns -2 (NGX_AGAIN) which you have to be prepared to
handle correctly (by calling it again as soon as something happens
on socket in question).
If it really returns -1 (NGX_ERROR) - it should log the reason via
ngx_connection_error() at appropriate logging level.
Maxim D.
Hello!
On Thu, Aug 27, 2009 at 05:10:51AM -0400, wangbin579 wrote:
use strace,the system alert:Resource temporarily unavailable
recv(8, 0x9bfb880, 55, 0) = -1 EAGAIN (Resource temporarily unavailable)
it appears that recv reads data when the data is not prepared.
it does not check if the data is available
It shouldn’t. Note that nginx is event-driven server, see here
for details:
Maxim D.