Some times header cannot be sent due too high traffic
Lord Nynex
lordnynex at gmail.com
Fri Sep 25 17:38:12 UTC 2015
Hello,
I'm just guessing here, but it sounds like the connection is closed before
the headers are sent. This is a common problem unrelated to nginx (unless
your module has some sort of serious performance issue elsewhere). This is
especially common for requests generated by mobile clients who's networks
are often unavailable.
The thing that stands out to me is your conditional to catch errors is very
similar to the conditional used in ngx_http_request.c, hoever, it's missing
NGX_HTTP_CLIENT_CLOSED_REQUEST. If this is the case, your condition is
satisfied because NGX_HTTP_CLIENT_CLOSED_REQUEST is > NGX_OK. I recommend
you amend your logging to include more information about why the request
has failed.
If you find that NGX_HTTP_CLIENT_CLOSED_REQUEST is returned, I would look
for culprits elsewhere. Perhaps the load is greater than the server/kernels
link speed?
On Thu, Sep 24, 2015 at 2:18 AM, Hung Nguyen <hungnv at opensource.com.vn>
wrote:
> Hello,
>
> In my module I do something like this:
>
> nlog->action = "sending file to client";
> r->headers_out.status = NGX_HTTP_OK;
> r->headers_out.content_length_n = bucket->content_length;
> r->headers_out.last_modified_time = of.mtime;
> r->headers_out.content_type.len = sizeof ("text/html") - 1;
> r->headers_out.content_type.data = (u_char *) "text/html";
> rc = ngx_http_send_header(r);
> if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
> ngx_log_error(NGX_LOG_ALERT, nlog, ngx_errno, ngx_close_file_n
> "ngx_http_send_header failed");
> return rc;
> }
>
>
>
> it’s ok when traffic is low, but when there are many user request to
> nginx, error log is full of these similar errors:
>
> 2015/09/17 08:57:16 [alert] 9915#0: *5205 close()ngx_http_send_header
> failed while sending file to client, client: 127.0.0.1, server: my.local,
> request: "GET
> /slides/128553.pdf?secl=LMz1w4xNwd9pt_88-ROxkw§=1442496276 HTTP/1.0",
> host: “m <http://kvazar.china-cdn88nmbwacdnln8hq8qwe.com>y.server.com",
> referrer: "http://my.server.com/uppod.swf <http://uakino.net/uppod.swf>”
>
>
>
>
> Is this a normal behavior, or there much be something wrong in my module
> cause nginx cannot send header to client?
>
>
> Thanks,
>
> Hưng
>
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150925/3940281f/attachment.html>
More information about the nginx-devel
mailing list