Hello!
On Sun, Jun 21, 2015 at 2:07 PM, Mathew Heard wrote:
> location / {
> srcache_fetch /__cache;
> [...]
> }
> location /__cache {
> proxy_pass cache_backend;
> [...]
> }
> We have noticed in the error log that every miss generates an error. It
> doesnt have any effect on the system, but it is annoying. The error reads as
> follows:
> srcache_fetch: cache sent invalid status line while sending to client
Will you provide a standalone and minimal example so that I can
reproduce the issue on my side?
> I have a theory that the conditions at
> https://github.com/openresty/srcache-nginx-module/blob/master/src/ngx_http_srcache_fetch.c#L307
> are at fault. Particularly that the status code should be checked before the
> cached status line.
>
That condition is irrelevant. You can note that the error message in
that code path is different:
"srcache_fetch: cache sent truncated status line or headers"
while yours is
"srcache_fetch: cache sent invalid status line"
Very different.
Maybe you can try patching that error logging statement in ngx_srcache
to make it generate more details about the actual response received
(like the response header and response body), which may help debugging
this. My hunch is that your backend server may produce erroneous
responses, but that's just a theory.
Another theory is that you forgot to configure
proxy_ignore_client_abort on;
in your cache backend location.
By default, this directive is off so that client aborts may interrupt
your srcache_store subrequests, resulting in truncated data in your
cache, leading to the "cace sent invalid status line" error in
subsequent cache fetches as expected.
Good luck!
Best regards,
-agentzh