Hi Mark,

On 6/14/23 19:43, Mark Thomas wrote:
There are multiple things that do not make sense in the above paragraph.

It well might be. Tomcat is quite large and complicated, I have not dig it through really thoroughly yet, that's why I asked here.

Servlets play no role in processing WebSocket data.

Hmm, they consume it!

Incoming WebSocket frames are processed synchronously on a single thread for as long as there is data to read. Processing may switch to a different thread between messages but that won't change the order in which messages are received on onMessage() is called.

The Jakarta WebSocket specification explicitly states that "In all cases, the implementation must not invoke an endpoint instance with more than one thread per peer at a time"

Does this strictly mean that any onMessage call may only happen after previous onMessage (of that same connection) returned?

Not sure if it'd make much sense to redo my testing of now obsolete Tomcat 7, but it definitely showed something different than that (in default configuration).

This all was observed ages ago and for Tomcat 7 a simple fix was found:

replace "Protocol=HTTP/1.1" with "Protocol=org.apache.coyote.http11.http11protocol"

Java class names and XML attribute names are case sensitive. And the quotes are in the wrong place. The above would never have worked. I assume you meant:

protocol="org.apache.coyote.http11.Http11Protocol"

Sure. That was quick hand-typing to show the idea, not exact copy-paste.
Same as below. I wouldn't expect anybody to insert something from emails into their server.xml blindly anyway :)


which is the deprecated (and removed in 8.5.x) BIO connector.

Yes, exactly.

There is no multi-threading within a single WebSocket connection. It is explicitly not allowed by the Jakarta WebSocket specification and Tomcat follows that rule.

Ok. Maybe I'll need to still dig through the code to understand what is going on better. In fact, I have not observed any actual reordering with Tomcat 9 yet, just changing threads, so it might be that some relevant bug was fixed in these last 12 years or so :)


Thank you,

Regards,
Nikolai

How do I configure that?

N/A.

You need to fix whatever it is in your application that is causing messages to be processed out of order.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to