Hi all, 

I need help on managing KeepAlive on my nginx webservice.

Seeing error logs seems that many keepalive HTTP request are discarded by
Nginx. On client side this behaviour seems to be a timeout.

This is my code:

        if(strlen(session->response) > 0) {
                b->pos = (u_char *)session->response;
                b->last = (u_char *)session->response + 
strlen(session->response);
                r->headers_out.content_type_len = strlen("application/json") - 
1;
                r->headers_out.content_type.data = (u_char *) 
"application/json";
                r->headers_out.status = NGX_HTTP_OK;

        } else {
        b->pos = (u_char *)r->args.data;
        b->last = (u_char *)r->args.data + r->args.len;
                r->headers_out.status = NGX_HTTP_NO_CONTENT;

        }
        r->headers_out.content_length_n = strlen(session->response);

        b->memory = 1;
        b->last_buf = 1;

        ftime(&end);
        felapsed=(int) (1000.0 * (end.time - start.time) +
                        (end.millitm - start.millitm));

        ngx_http_send_header(r);

        ngx_http_output_filter(r, &out);
        ngx_http_finalize_request(r, r->headers_out.status);

Sometimes i Send a 200 Ok and some other times 204.

On nginx error log I see:


2016/07/04 11:06:11 [debug] 11643#11643: *13 http finalize request: 204,
"/mopub_bidr?" a:1, c:2
2016/07/04 11:06:11 [debug] 11643#11643: *13 http terminate request count:2
2016/07/04 11:06:11 [debug] 11643#11643: *13 http terminate cleanup count:2
blk:0
2016/07/04 11:06:11 [debug] 11643#11643: *13 http finalize request: -4,
"/mopub_bidr?" a:1, c:2
2016/07/04 11:06:11 [debug] 11643#11643: *13 http request count:2 blk:0
2016/07/04 11:06:11 [debug] 11643#11643: *13 http posted request:
"/mopub_bidr?"


Someone can me explain what means "finalize request: -4" ? It's an error?


Sometime into error log I found this error:

 recv() not ready

and this seems the cause of client timeouts. how can I resolve it on nginx
conf?

Thanks a lot for help

Stefano G.

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,268052,268052#msg-268052

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to