-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 12.0.5 WebSocket 'per-message-deflate' truncates data received in browsers only under Windows #11015
Comments
Do you think the bug is in Windows versions of Chrome/Firefox/Edge, as I do not get this problem under iOS (17.1.2) or macOS (Sonoma)? |
@minduch I checked the server logs and all seems ok: we split the content into 4 writes of 8192 compressed bytes + some remaining, and we correctly remove the tail bytes added by the compressor, as mandated by the specification. Seems really a client bug. |
@sbordet I did check too, however I'm not so good at looking at the Jetty debug output :-(. On the client side, you see it receiving correctly the first 41658 bytes, but not the entire package of 61933 bytes! For Do you have a test-case Jar I could run in my environment to test it out? |
@sbordet Does Jetty have test cases with e.g. Chrome as Client using large binary WebSocket blocks received and send from/to a Jetty Server with and without |
I ran into the QNAP NAS products having similar problems with WebSockets and Chrome/Edge/Firefox. It did work well on macOS Safari though (from latest Sonoma 14.2.1 or iOS). Have you hard of similar problems? |
@minduch I just tried with FF 121 on Ubuntu and permessage-deflate works fine for me. Are you using Jetty core or ee10? Since 12.0.3 there were very minimal changes to WebSocket, and none to the permessage-deflate code, so it's strange that the problems does not show in 12.0.3. Can you give #11090 a try, and see if the problem persist? |
@sbordet This problem remains in 12.0.5 and the "todays" latest versions of Edge (121.0.2277.4 (Official build) stable app, beta channel (64-bit)), Firefox, Chrome and Chrome Canary under Windows. It doesn't matter if WebSockets use HTTP or HTTPS, it gets the SAME error. As MANY users do run Windows and not all macOS/Linux, I think this problem is quite severe, alothough there is a workaround to turn the WebSockets Extensions OFF. Safari works OK on macOS and iOS. Is the fix #11090 included in 12.0.5, or will it be included in 12.0.6 (later this month)? |
I also edited the client environment in the first report of this issue and the Jetty version to 12.0.5. @sbordet What really bothers me is that it's all the major browsers under Windows, with HTTPS and HTTP, and it's not HTTP/2-related, nor HTTP/3, nor Conscrypt, nor GzipHandler from issue #11095 - I tested to turn off our HTTP/2+3+Conscrypt and it still shows the error every time. |
12.0.6 |
@minduch would be helpful to understand if there is a message size that triggers this. Can you test 1-10-100-1000-etc. bytes and see which one works and which one does not? We're trying to setup a Windows environment to test it out. |
Testing on Windows 10 (up to date as of Jan 2, 2024) There are no problems encountered with permessage-deflate with TEXT or BINARY on ...
This was done on the Jetty 12 ee10 environment. What specific scenarios do you have? |
If you have any active firewall products on your windows computer, turn them off and try again (we've had reports in the past of various security software interfering with networking in browsers). Also, do you have a proxy in use? (this is another source of odd behaviors) |
Oohh, right, Windows Firewall/Defender -- always forget about this Windows feature! 🙄 |
OK, so I've modified our Feodora 39 Server on Internet at "mt.iizi.co", running Temurin 21.0.1 with Virtual Threads. We do not use any proxies. Accessing "mt.iizi.co" is direct to Jetty 12.0.5 on ports 80, 8080 and 443 (TLS certs from Let's Encrypt using ACME protocol). Actually, it should also open for HTTP/3 on UDP port 443. It fails when starting the app in Chrome/Edge/Firefox under Windows 10 and 11 using the URL: It works in Ubuntu 22 Firefox 120.0 AND Chrome 120.0.6099.129 (just installed it). Latest AppStore-available Chrome and Edge under iOS 17.2.1 on iPhone has stopped working, Safari under same iOS works fine. Latest macOS Sonoma 14.2.1 works with Safari, but not under Chrome [120.0.6099.129 (Official Build) (arm64) on MacMini M2 Pro], DevTools Console shows ![]() Above, ![]() I don't really understand anymore. The error occurs under Windows when receiving binary data (in this case using HTTPS and perhaps HTTP/2, I'm not sure. We have AVG firewall in use, but I have turned it off with the same results, i.e. when no Firewall is active, AVG and/or Windows Defender. Our JavaScript program reports: or Try it out... We use these Jetty + Jakarta classes/annotations:
Please find the Jetty log created with the Jetty logger: Our logger (showing multiple warnings due to Jetty GzipHandler, see other issue @sbordet has generated a PR for): Please let me know if you need more info, I will be happy to provide you with it. Again: Happy New Year! |
Testing on the same Windows 10 laptop against your URL shows no signs of the failures you are experiencing. Chrome Firefox All but one request succeeds. (The request to |
This issue has been automatically marked as stale because it has been a |
Jetty version(s)
Jetty 12.0.5
Jetty Environment
Jetty 12.0.5 websockets
Java version/vendor
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)
(but it also happens in e.g. Java 17 without Virtual Threads)
OS type/version
Client side:
Win11Pro and other Windows versions with latest Chrome/ChromeCanary/Firefox/Edge.
HOWEVER: on macOS Sonoma -- IT WORKS JUST FINE !!! (don't ask me why)
Also seems to be OK on Firefox 120.0 on at least Ubuntu.
Description
per-message-deflate
extension in WebSockets causes (BINARY) messages to be truncated to the client side. It looks like the client (JavaScript Chrome) gets an uncompressed message with the length of the deflated message, i.e. cut off!I have not seen this problem in versions of Jetty prior to 12.0.3, however, I saw it in quite early versions like 9.x when websockets came out.
How to reproduce?
Our pretty complex platform consists of embedded Jetty 12.0.3 and a JavaScript client. It's available on the net, but for now, we have had to turn off Jetty WebSocket Extensions by calling
JettyServerUpgradeResponse.setExtensions(Collections.emptyList());
. This "cures" the problem. The REALLY strange thing is that iOS and macOS (Sonoma) Chrome/Safari works just fine with the extensions turned on!I attached the server-side logging and the client side in two Word documents. Search for "HERE IS THE PROBLEM" in yellow background. We added a header to our message to know internally how long it SHOULD be on the JavaScript side, and in this case, it is truncated from 61937 bytes to 41658 (looks like deflated size), (sorry for the character set being "translated" when pasted into Word).
Right now we have updated all our servers to disable WebSocket Extensions in Jetty in order to make it work, but it's a configurable environment variable, so if you need more info, I will be happy to help!
client-side.docx
server-side.docx
The text was updated successfully, but these errors were encountered: