jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.88k stars 1.91k forks source link

Frame size error while using Http/2 in Jetty 9.4.40 #6695

Closed karthickm512 closed 2 years ago

karthickm512 commented 3 years ago

Jetty version(s) 9.4.40

Java version/vendor (use: java -version) Java 1.11

OS type/version SUSE Linux 15

Description We use Jetty for Http/2 handling in 2 environments with different versions. Http/2 traffic towards Jetty 9.3.21 works fine. Here the frame size was set to 8 Mb. Http/2 traffic towards 9.4.40 fails with Frame_size_error . I have tried changing the frame size to 8Mb, 4Mb, 2 Mb, and it fails in all the cases.

How to reproduce?

Logs from Jetty {"version": "0.2.0", "timestamp": "2021-09-02T05:29:46.424Z", "severity": "debug", "service_id": "test-server", "metadata" : {"category": "Test"}, "message": ".jetty.util.log.JettyAwareLogger 625 Parsed [DATA|21543|0|3] frame header from java.nio.HeapByteBuffer[pos=9 lim=17408 cap=17408]@c158f49"} {"version": "0.2.0", "timestamp": "2021-09-02T05:29:46.424Z", "severity": "debug", "service_id": "test-server", "metadata" : {"category": "Test"}, "message": ".jetty.util.log.JettyAwareLogger 625 Session failure HTTP2ServerSession@60bf10d3{local:/127.0.0.1:13181,remote:/127.0.0.1:34282,sendWindow=65535,recvWindow=1048576,state=[streams=1,CLOSING,goAwayRecv=null,goAwaySent=GoAwayFrame@4617b05b{3/frame_size_error/invalid_frame_length},failure=java.io.IOException: frame_size_error/invalid_frame_length]}"}

Is there any expected frame size set by latest Jetty by default?

sbordet commented 3 years ago

Parsed [DATA|21543|0|3] frame header

There is a DATA frame with length 21543 which is beyond the default frame size of 16 KiB.

What client are you using?

karthickm512 commented 3 years ago

I am using Synopsys Defensics. I will check with them on how to reduce the DATA frame size, however I am wondering how the same requests (of equal DATA length) was successful on old Jetty versions. Do you know of any fixes/improvements done on this part at Jetty in 9.4.x ?

joakime commented 3 years ago

The HTTP/2 Frame max size default is 16,384 bytes (0x4000) - this is per spec - https://datatracker.ietf.org/doc/html/rfc7540#section-4.1 It's been that way since Jetty 9.3.0.M0.

See: https://github.com/eclipse/jetty.project/blame/jetty-10.0.x/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/frames/Frame.java#L19

We were actually out of HTTP/2 spec compliance on a few new max length tests that were introduced in a later revision to the industry h2spec test suite. Which we fixed around Jetty 9.4.12 timeframe in commit https://github.com/eclipse/jetty.project/commit/5836c50a20f813a1346bdd5c83bebc7ba68e0f2c

sbordet commented 3 years ago

@karthickm512 we need the server-side DEBUG logs to understand what's going on.

karthickm512 commented 3 years ago

Hi @sbordet , I now reduced the payload size to 13kb and it worked successfully. But the problem is, real time traffic will be in Mega Bytes. The logs are what I attached earlier, showing the DATA frame size.

sbordet commented 3 years ago

@karthickm512 the Jetty logs you posted are just 2 lines. We need the whole communication between the client and the server.

I think it's a client problem. Jetty has no problem handling any size of uploads with HTTP/2 compliant clients such as browsers and other libraries. I would reach out to Synopsys Defensics.

Do you have the same problem if you use a different client?

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.