-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Add formatting for SockJS close GoAway frame to prevent infinite loop for xhr-polling and xhr-streaming transport #28000
Conversation
… for xhr-polling and xhr-streaming transport
This one caused me some headaches and made my userbase a DDoS army. Good job for figuring this one out! |
Thanks for figuring out the root cause! |
Thank you for figuring this out. @zbykovskyi I am struggling with the same issues since last 3 Months. When can we expect the new release? Cheers!! |
You can put files with fix locally to be the first in your classpath to override original files for now until official bugfix will be released Cheers! |
@zbykovskyi Can you please give an example of the classpath for this and the file to include first? We are trying to fix here and would really appreciate the help :-) Thanks! |
You are our savior. Thanks a lot :) |
Copy the next original Spring files and put them in your project`s codebase in the same package:
Then apply patch from current pull request and compile your project. |
Prevents infinite loop for xhr-polling and xhr-streaming transports. See gh-28000
Could you add more details on your issue? What is the body of http POST requests and how to reproduce that behaviour? |
This pull request is regarding the issue of infinite loop in SockJS library for xhr-polling and xhr-streaming transport.
When Spring sends unformatted frame SockJsFrame.closeFrameGoAway() without ending \n like c[1000, "Go Away!"] then SockJS library is unable to parse it correctly and to recognise it as native close frame. Instead of that SockJS treats it as just plain text.
xhr.js file has next method to parse inbound text message:
That method expects \n at the end of the SockJS text frame.
But in case of "Connection already closed (but not removed yet) for sessionId" Spring Framework sends unformatted SockJsFrame.closeFrameGoAway() without ending \n. That leads to infinite loop at SockJS library because it is unable to parse that frame.
This fix is about to add formatting for SockJsFrame.closeFrameGoAway() before sending to the client.
Some reported issues:
sockjs/sockjs-client#418
sockjs/sockjs-client#308
https://stackoverflow.com/questions/37030416/sockjs-infinite-xhr-streaming-calls-after-reconnect/70957300#70957300