[undertow-dev] JSR WebSocket onMessage called out-of-order

Stephan Mehlhase stephan.mehlhase at eml.org
Tue Mar 17 09:36:31 EDT 2015


Hi,

I ran into an issue with the Undertow JSR WebSocket implementation: the
message handler's @OnMessage method is not called with messages in the
same order as these were sent. I encountered this problem first with the
current WildFly 8.2.0.Final version. I posted about it in the forums
[1]. But since I got no replies there and can reproduce this problem
with Undertow 1.2.0.Beta4 (from maven) alone, I thought this might be
the right place to ask about it.

I am developing a @ServerEndpoint which needs to handle clients sending
unfragmented messages in rapid succession. These messages are not always
delivered in the order as they were sent. Since WebSocket is based on
HTTP, I assume that the messages arrive in the "correct" order at the
server. However, from time to time two messages appear switched (e.g.
message no. 4 arrives at @OnMessage before message no. 3). If I fragment
the messages (according to RFC 6455), the order of all messages is
always correct.

I have uploaded an example application which reproduces this to

http://pastebin.com/tcm6ZnsB

It uses some Guava classes for checking the order of messages.

I can also reproduce this problem with another (non-public but RFC
compliant) WebSocket library.

My first question is, if that is intended behavior or a bug? The
WebSocket RFC  does not explicitly forbid this kind of behavior, however
for me it was very surprising given that
	1. the underlying protocols deliver everything in order,
	2. this works as I expected it for fragmented messages and
	3. I haven't seen this for other implementations.

If this is not considered a bug, is there an option which basically
forces in-order delivery of messages? Ideally even accessible in
WildFly. If not, does opening a feature request for this make sense
(i.e. does it have a realistic chance of being addressed)?


Best,
Stephan



[1]: https://developer.jboss.org/message/921226#921226

-- 

Stephan Mehlhase
Email: stephan.mehlhase at eml.org

EML European Media Laboratory GmbH
Schloss-Wolfsbrunnenweg 35
69118 Heidelberg

Amtsgericht Mannheim / HRB 335719
Managing Partner: Dr. h. c. Dr.-Ing. E. h. Klaus Tschira, Scientific and
Managing
Director: Prof. Dr.-Ing. Andreas Reuter

http://www.eml.org


More information about the undertow-dev mailing list