-
Notifications
You must be signed in to change notification settings - Fork 161
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
fix: Fix failure when Vite sends many messages in sequence #19340
Conversation
Sending multiple messages at the same time resulted in java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method which originates in calling `browserSession.getAsyncRemote().sendText` a second time before the complete callback for the first call has been called. Now the getBasicRemote() method is used instead which blocks until the message has been sent.
Quality Gate passedIssues Measures |
Sending multiple messages at the same time resulted in java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method which originates in calling `browserSession.getAsyncRemote().sendText` a second time before the complete callback for the first call has been called. Now the getBasicRemote() method is used instead which blocks until the message has been sent.
…19343) Sending multiple messages at the same time resulted in java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method which originates in calling `browserSession.getAsyncRemote().sendText` a second time before the complete callback for the first call has been called. Now the getBasicRemote() method is used instead which blocks until the message has been sent. Co-authored-by: Artur <artur@vaadin.com>
browserSession.getNegotiatedSubprotocol(), msg -> { | ||
try { | ||
browserSession.getBasicRemote().sendText(msg); | ||
} catch (IOException e) { | ||
getLogger().debug("Error sending message to browser", | ||
result.getException()); | ||
e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only side effect of this PR (I just checked because of copilot Slack discussion), that we will not have debug logs anymore for the sent messages. Potentially it could be added back in case of need.
browserSession.getNegotiatedSubprotocol(), msg -> {
try {
browserSession.getBasicRemote().sendText(msg);
getLogger().debug("Message sent to browser: {}", msg);
} catch (IOException e) {
getLogger().debug("Error sending message to browser",
result.getException());
e);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. I thought it was intentionally removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Peter for pointing out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to intervene with your PR review, Marco. I just checked it because we had internal conversations about this issue in the Copilot channel. Thanks for the review and your kindness, as you always show. 🙇 💙
Was unintentionally removed in #19340
Was unintentionally removed in #19340
Was unintentionally removed in #19340
This ticket/PR has been released with Vaadin 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version. |
Sending multiple messages at the same time resulted in
which originates in calling
browserSession.getAsyncRemote().sendText
a second time before the complete callback for the first call has been called.Now the getBasicRemote() method is used instead which blocks until the message has been sent.