New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR #167
Comments
Looks like the h2 protocol needs to forcefully close response bodies in case the request handler sends a body on HEAD requests. This seems to be the difference between php and static file handler. |
So by what could this be caused? And how do you think this could be fixed? |
I need to add a test case for this and make a fix in the h2 code. You are able to build mod_http2 from here and verify a fix? |
Yeah that should be possible. |
Ok, question is, can you provide me a mini config how you setup your php? There are several possibilities and I'd like to make sure we are looking at the same one. (I have python cgi setup in my standard h2 tests, but they do not expose that problem) |
Sure:
Need something more? :) |
@danel1 could you check release v1.11.3? I think this should solve your issue. |
… request handler missed to signal it the normal way (eos buckets). Addresses github issues icing/mod_h2#164, icing/mod_h2#167 and icing/mod_h2#170. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1843426 13f79535-47bb-0310-9956-ffa450edef68
mod_http2: adding defensive code for stream EOS handling, in case the request handler missed to signal it the normal way (eos buckets). Addresses github issues icing/mod_h2#164, icing/mod_h2#167 and icing/mod_h2#170. Submitted by: icing Reviewed by: icing, ylavic, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1843468 13f79535-47bb-0310-9956-ffa450edef68
Hey @icing |
Hi @icing, |
Thanks @vl-grigorov, I am currently rather busy with work (projects want to close before X-mas), but will definitely look into this. Can you, on the apache ticket, also include the config part how you enable/embed php? There usually are several possibilities to do so and I am suspecting the method used is relevant to analyze this. Thanks. |
Hello @icing, apache bugzilla started rejecting me with with Error 502 (apache bug system hit a bug?) so I'm not sure I was able to update the ticket. That's why I'll post my notes here too:
=====
|
Also seeing this issue with Apache 2.4.37 and PHP running via |
The bug occurs if the client performs a HEAD request and if the content generator module calls This bugfix works for me:
I added |
@mkauf, finding all my mistakes... :-) I'll make a version tomorrow with this change and, if verified by the folks here, bring it into the Apache subversion space. |
I'd appreciate if you could test v1.12.1 where I applied @mkauf 's patch (with modifying |
Seems to be working fine. I tested on Ubuntu Trusty with Apache 2.4.37-1+ubuntu14.04.1+deb.sury from Ondrej PPA. Before updating mod_http2:
After Update to mod_http v1.12.1:
Same Request with
|
ping, @danel1, I would like to close this after tests by @felixbuenemann verify it works for him. |
Quick question, I'm getting similar issues when we're doing HEAD on something served via For completeness sake:
This also happens when using valid SSL certificates and no authorization, but we disabled HTTP/2 in the public-facing section since Safari was having issues (either due to this or something else, but economical considerations forced the customer to go for the "safe" approach, until we can or can not verify it's the fault of HTTP/2 handling in Safari), thus I couldn't test it that way right now. |
@towo can you take v1.12.1 out for a spin and check if it is fixed for you as well? |
@icing I can try, but does it compile w/ 2.4.23? That's the current environment here (SLES 12), otherwise I'd have to try it with an unpatched build of a recent Apache first just to exclude any additional troubles introduced by the version bump. |
@icing Sorry for the delay! Tried right now with v1.12.2 and it works like a charm! Thanks for the fix! |
I'm having a bit of trouble implementing 1.21.1 to test in this environment here; I'll defer to testing it as soon as I get an upstream package and if the issue still persists, I can always re-open (or rather create a new issue). Thanks! |
…be specified per Location/Directory, e.g. disabling PUSH for a specific set of resources. [Stefan Eissing] *) mod_http2: HEAD requests to some module such as mod_cgid caused the stream to terminate improperly and cause a HTTP/2 PROTOCOL_ERROR. Fixes <icing/mod_h2#167>. [Michael Kaufmann] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1852339 13f79535-47bb-0310-9956-ffa450edef68
Thanks guys! Fix has landed in r1852339 in Apache subversion trunk. Will propose for backport to 2.4.x. |
FYI, I've received a backport PTF by @SUSE which fixes my problem with chained |
Nice of them. Thanks for letting us know! |
Correct, thanks for the reminder. I have a bunch of other changes which are to be merged, but I should do this one independently. |
Proposed in r1854966. |
…963,1854964,1855295,1855411 from trunk: *) mod_http2: when SSL renegotiation is inhibited and a 403 ErrorDocument is in play, the proper HTTP/2 stream reset did not trigger with H2_ERR_HTTP_1_1_REQUIRED. Fixed. [Michael Kaufmann] *) mod_http2: new configuration directive: `H2Padding numbits` to control padding of HTTP/2 payload frames. 'numbits' is a number from 0-8, controlling the range of padding bytes added to a frame. The actual number added is chosen randomly per frame. This applies to HEADERS, DATA and PUSH_PROMISE frames equally. The default continues to be 0, e.g. no padding. [Stefan Eissing] *) mod_http2: ripping out all the h2_req_engine internal features now that mod_proxy_http2 has no more need for it. Optional functions are still declared but no longer implemented. While previous mod_proxy_http2 will work with this, it is recommeneded to run the matching versions of both modules. [Stefan Eissing] *) mod_proxy_http2: changed mod_proxy_http2 implementation and fixed several bugs which resolve PR63170. The proxy module does now a single h2 request on the (reused) connection and returns. [Stefan Eissing] *) mod_http2/mod_proxy_http2: proxy_http2 checks correct master connection aborted status to trigger immediate shutdown of backend connections. This is now always signalled by mod_http2 when the the session is being released. proxy_http2 now only sends a PING frame to the backend when there is not already one in flight. [Stefan Eissing] *) mod_proxy_http2: fixed an issue where a proxy_http2 handler entered an infinite loop when encountering certain errors on the backend connection. See <https://bz.apache.org/bugzilla/show_bug.cgi?id=63170>. [Stefan Eissing] *) mod_http2: Configuration directives H2Push and H2Upgrade can now be specified per Location/Directory, e.g. disabling PUSH for a specific set of resources. [Stefan Eissing] *) mod_http2: HEAD requests to some module such as mod_cgid caused the stream to terminate improperly and cause a HTTP/2 PROTOCOL_ERROR. Fixes <icing/mod_h2#167>. [Michael Kaufmann] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1855431 13f79535-47bb-0310-9956-ffa450edef68
mod_http2: adding defensive code for stream EOS handling, in case the request handler missed to signal it the normal way (eos buckets). Addresses github issues icing/mod_h2#164, icing/mod_h2#167 and icing/mod_h2#170. Submitted by: icing Reviewed by: icing, ylavic, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1843468 13f79535-47bb-0310-9956-ffa450edef68
…963,1854964,1855295,1855411 from trunk: *) mod_http2: when SSL renegotiation is inhibited and a 403 ErrorDocument is in play, the proper HTTP/2 stream reset did not trigger with H2_ERR_HTTP_1_1_REQUIRED. Fixed. [Michael Kaufmann] *) mod_http2: new configuration directive: `H2Padding numbits` to control padding of HTTP/2 payload frames. 'numbits' is a number from 0-8, controlling the range of padding bytes added to a frame. The actual number added is chosen randomly per frame. This applies to HEADERS, DATA and PUSH_PROMISE frames equally. The default continues to be 0, e.g. no padding. [Stefan Eissing] *) mod_http2: ripping out all the h2_req_engine internal features now that mod_proxy_http2 has no more need for it. Optional functions are still declared but no longer implemented. While previous mod_proxy_http2 will work with this, it is recommeneded to run the matching versions of both modules. [Stefan Eissing] *) mod_proxy_http2: changed mod_proxy_http2 implementation and fixed several bugs which resolve PR63170. The proxy module does now a single h2 request on the (reused) connection and returns. [Stefan Eissing] *) mod_http2/mod_proxy_http2: proxy_http2 checks correct master connection aborted status to trigger immediate shutdown of backend connections. This is now always signalled by mod_http2 when the the session is being released. proxy_http2 now only sends a PING frame to the backend when there is not already one in flight. [Stefan Eissing] *) mod_proxy_http2: fixed an issue where a proxy_http2 handler entered an infinite loop when encountering certain errors on the backend connection. See <https://bz.apache.org/bugzilla/show_bug.cgi?id=63170>. [Stefan Eissing] *) mod_http2: Configuration directives H2Push and H2Upgrade can now be specified per Location/Directory, e.g. disabling PUSH for a specific set of resources. [Stefan Eissing] *) mod_http2: HEAD requests to some module such as mod_cgid caused the stream to terminate improperly and cause a HTTP/2 PROTOCOL_ERROR. Fixes <icing/mod_h2#167>. [Michael Kaufmann] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1855431 13f79535-47bb-0310-9956-ffa450edef68
… request handler missed to signal it the normal way (eos buckets). Addresses github issues icing/mod_h2#164, icing/mod_h2#167 and icing/mod_h2#170. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1843426 13f79535-47bb-0310-9956-ffa450edef68
…be specified per Location/Directory, e.g. disabling PUSH for a specific set of resources. [Stefan Eissing] *) mod_http2: HEAD requests to some module such as mod_cgid caused the stream to terminate improperly and cause a HTTP/2 PROTOCOL_ERROR. Fixes <icing/mod_h2#167>. [Michael Kaufmann] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1852339 13f79535-47bb-0310-9956-ffa450edef68
So for those of us getting software from public repos, is this update not available until Apache 2.5.1 becomes available in repos? (main Ubuntu repos, or ondrej) I'm in an earlier described situation where all iOS devices are failing to load my website, and this sure looks to be the http/2 issue |
These changes are all part of Apache httpd v2.4.41, released in August 2019. If/when the distro of your choice picks this up, is beyond my control. You have to take it up with them or chose another one. |
But I have 2.4.41 and I still had the issue :/ |
Then then question is what the issue exactly is that you have. And in order to find out, you need to provide some data or log files. For example, if you can reproduce the request that fails, enabled deep logging on the server:
make the failing request and attach the log file here. |
Well, the server is now in production so I can't switch that over to a broken state. I was using the Apache2 provided by the onredj PPA btw. |
I do not understand what it is you want, then. You seem to have the latest fixes that resolve the issue reported here. Maybe it does not work for you or you experience a complete different issue or the issue you saw is somewhere else entirely. There seems to be nothing I can do for you unless you bring more to the table. |
I understand, I wish I could provide more info. It was a doosie to find the issue was HTTP/2 anyways. If I get more info, I'll post it here, until then, sorry about that. |
Hi there
We are seeing the following problem:
Thanks for taking a look at it.
curl HEAD output:
curl GET output:
HEAD via Google Chrome Console:
Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR
The text was updated successfully, but these errors were encountered: