Skip to content
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/1 Clear Text Requests to HTTP/2 servers wait forever, if called with DELETE method and Body #4643

Closed
2 tasks done
ckosmowski opened this issue Dec 1, 2020 · 11 comments
Closed
2 tasks done
Assignees
Labels
status: example attached status: validated An issue that has been validated as being a bug type: bug Something isn't working
Milestone

Comments

@ckosmowski
Copy link

Thanks for reporting an issue, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.

Task List

  • Steps to reproduce provided
  • [-] Stacktrace (if present) provided
  • [-] Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create a Http Service with micronaut
  2. Implement a simple GET route
  3. Implement a second route with DELETE OR PUT with body parameters
  4. Test the routes in any order (with simple HTTP/1.1 clients) -> it works as expected
  5. Configure it to use Http/2
  6. Test the routes again (with simple HTTP/1.1 clients)

Expected Behaviour

The routes will still respond correctly in any order

Actual Behaviour

  • If we start with the DELETE or PUT route in our test, it will wait forever, no response is received, no exception is raised.
  • If we start with the GET request first, and use the other route afterwards, all subsequent calls to DELETE and PUT will succeed.
  • After waiting a while without calling, DELETE and PUT will fail again, until another GET request is issued.

Environment Information

  • Operating System: Linux
  • Micronaut Version: 2.2.0
  • JDK Version: 8

Example Application

@graemerocher graemerocher added the status: awaiting validation Waiting to be validated as a real issue label Dec 1, 2020
@volkerrichert
Copy link

volkerrichert commented Dec 1, 2020

I also had this issue with "PUT", as I described on gitter / questions on Nov. 25 18:16

@graemerocher
Copy link
Contributor

Can one of you attach an example

@volkerrichert
Copy link

check out https://github.com/volkerrichert/mnIssus4643 and run tests. It will fail on put.

reorder test wit get first or switch to http 1.1

@volkerrichert
Copy link

current test will fail with:

Read Timeout
io.micronaut.http.client.exceptions.ReadTimeoutException: Read Timeout
	at io.micronaut.http.client.exceptions.ReadTimeoutException.<clinit>(ReadTimeoutException.java:26)
	at io.micronaut.http.client.netty.DefaultHttpClient$12.exceptionCaught(DefaultHttpClient.java:2258)
	at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302)
	at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281)

@graemerocher graemerocher added this to the 2.2.1 milestone Dec 2, 2020
@graemerocher graemerocher self-assigned this Dec 2, 2020
@graemerocher graemerocher removed the type: bug Something isn't working label Dec 2, 2020
@graemerocher graemerocher removed this from the 2.2.1 milestone Dec 2, 2020
@graemerocher
Copy link
Contributor

@volkerrichert the example works if you inject an HTTP/2 client

@Inject
@Client(id = "/", httpVersion = HttpVersion.HTTP_2_0)
RxHttpClient client;

So the actually problem is HTTP 1.1 clients can't talk to an HTTP/2 server, that clears things up. Investigating... not sure if a bug yet.

@graemerocher graemerocher changed the title Requests to HTTP/2 servers wait forever, if called with DELETE method and Body HTTP/1 Requests to HTTP/2 servers wait forever, if called with DELETE method and Body Dec 2, 2020
@volkerrichert
Copy link

But why does it work after doing the GET - request first? This request shouldn't work also. Thats's stange.

@ckosmowski
Copy link
Author

If this is the case, i would suggest a downgrade feature or something. Because at least in my case you rarely are aware of all the clients using your server and you are not in control of changing the clients.

@graemerocher
Copy link
Contributor

@volkerrichert there is a bug in the way the Netty channel is downgraded to HTTP/1.1 which I am looking into. But the root cause is attempting to send HTTP/1.1 requests over HTTP/2

@ckosmowski in this case the downgrade support is not working but only if the request has a body (like a PUT or a GET)

It seems to be a core Netty issue because the CleartextHttp2ServerUpgradeHandler which we are using (a Netty class) discards the body and prevents it from being read again when attempting to do the connection upgrade.

@ckosmowski
Copy link
Author

@graemerocher Thank you for claryfiing.

When CleartextHttp2ServerUpgradeHandler is involved would you expect this to work with self signed certificates and SSL enabled?

@graemerocher
Copy link
Contributor

Yes SSL uses a completely different codepath and doesn't involve CleartextHttp2ServerUpgradeHandler

@graemerocher graemerocher changed the title HTTP/1 Requests to HTTP/2 servers wait forever, if called with DELETE method and Body HTTP/1 Clear Text Requests to HTTP/2 servers wait forever, if called with DELETE method and Body Dec 2, 2020
@graemerocher graemerocher removed their assignment Apr 14, 2021
@yawkat yawkat added status: validated An issue that has been validated as being a bug type: bug Something isn't working and removed status: awaiting validation Waiting to be validated as a real issue labels Oct 7, 2021
@yawkat
Copy link
Member

yawkat commented Oct 7, 2021

This is fixed by #6300 for the test case by @volkerrichert (thanks!). I have not tested it with DELETE, but the patch should apply to any first request with a body.

@yawkat yawkat closed this as completed Oct 8, 2021
@yawkat yawkat added this to the 3.1.0 milestone Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: example attached status: validated An issue that has been validated as being a bug type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants