ngx_unix_recv problem

Maxim Dounin mdounin at mdounin.ru
Thu Aug 27 13:12:37 MSD 2009


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 Dounin





More information about the nginx mailing list