Error - Context canceled

Hello,

With the push and proxy directives, I have a lot of errors on log file identified as “context canceled”, what is this error ?

EDIT: When I remove the push directive, “context canceled” error disappear. Maybe something is not correctly handled on the push or proxy directives when client browser already have pushed files in cache.

I’m using Caddy 0.10.3

19/May/2017:16:41:12 +0000 [ERROR 502 /assets/app/js/application.min.js] context canceled
19/May/2017:16:41:12 +0000 [ERROR 502 /assets/app/css/application.min.css] context canceled
19/May/2017:16:41:12 +0000 [ERROR 502 /assets/app/img/nut.png] context canceled
19/May/2017:16:41:12 +0000 [ERROR 502 /assets/app/img/plus-black.png] context canceled
19/May/2017:16:41:12 +0000 [ERROR 502 /assets/app/img/logo-cashless-white.svg] context canceled
19/May/2017:16:41:14 +0000 [ERROR 502 /assets/landing/img/flags/fr.png] context canceled
19/May/2017:16:41:14 +0000 [ERROR 502 /assets/landing/img/flags/en.png] context canceled
19/May/2017:16:41:14 +0000 [ERROR 502 /assets/app/css/application.min.css] context canceled
19/May/2017:16:41:14 +0000 [ERROR 502 /assets/app/img/logo-cashless-white.svg] context canceled
19/May/2017:16:41:14 +0000 [ERROR 502 /assets/app/img/arrow-down.png] context canceled
...
19/May/2017:16:43:12 +0000 [ERROR 502 /assets/landing/img/flags/fr.png] context canceled
19/May/2017:16:43:12 +0000 [ERROR 502 /assets/landing/img/flags/en.png] context canceled
19/May/2017:16:43:12 +0000 [ERROR 502 /assets/app/css/application.min.css] context canceled
19/May/2017:16:43:12 +0000 [ERROR 502 /assets/app/img/nut.png] context canceled
19/May/2017:16:43:12 +0000 [ERROR 502 /assets/app/img/logo-cashless-white.svg] context canceled

@tw4452852 - do you think this is a natural consequence of using push? Does it cancel context or are we missing something?

Weird, I tested on my local site, but can’t reproduce. Could you please file a issue and supply more information about it ?

Letsee, this would happen (while proxying) if the client is closing the connection, right? … I’m just brainstorming.

Yes, I think it is expected if client is closing the request.

No @tw4452852 it is not expected. If client already have pushed elements in cache, client will cancel server push. I think the push module have to deal with it and don’t have to throw 502 Context canceled error in this case. They have a difference between a browser who cancel the push due to error or because it already have file in cache.

In the same way, Caddy don’t log as error when a client cancel the download of a big file…

Is it possible to disable log for push directive? We can’t just tell to all out clients to disable cache in browsers…

This is a fair point, perhaps if the client cancels the request, it’s not really an error for the server to worry about. We could either change the log line to INFO or we could remove it completely (but I do worry if people who are debugging something would want that log line present).

Any news on this topic?

I just switched from caddy 0.9.5 to 0.10.4 and now my logs are full of ERROR 502 context canceled messages. I am using caddy as proxy for an api which receives HTTP/1.1 POST requests with Header Connection: close.
The requests are proxied correctly.

Do all of the clients now receive HTTP 502 Status responses?

Is there any way to disable this behaviour?

Your access logs (the log directive) will show you the response code; my guess is that they’re not seeing 502s and that the connection being closed is probably what is canceling the context.

I’m not sure yet if removing this log message could hide network or configuration problems or if it is just noise…

My log directive looks like this: log / stdout "{remote} - [{when_iso}] \"{method} {host}{uri} {proto}\" {status} {size}"

This is an actual log entry I am seeing.

04/Jul/2017:06:29:19 +0000 [ERROR 502 path] context canceled
remote - [2017-07-04T06:29:19Z] "POST path HTTP/1.1" 502 16

Hmmm, not what I would have expected. Bad Gateway is sent if the backend is thought to be down or unreachable. Strange, since I’m not seeing that with any of my proxied APIs or sites (hint: this forum is one of them; Caddy site itself has some others, etc). I’m not using push, except on a few pages, but they seem to be working okay.

Could just be a quirk with push?

If someone could open an issue on GitHub and follow the template, we should be able to pinpoint this easier. Especially if you have a little repo we can download with a Caddyfile and run it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.