Bug 57776 - Fragmented message error
Fragmented message error
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: WebSocket
8.0.21
Other Linux
: P2 normal (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
: 57831 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2015-03-29 04:45 UTC by Steve Demy
Modified: 2015-04-19 07:38 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Demy 2015-03-29 04:45:43 UTC
Vaadin 7.4.2 webapp runs perfectly in Tomcat 8.0.20 repeatedly evokes IllegalStateException in Tomcat 8.0.21:

Exception in thread "WebSocketServer-localhost-/vfc-6" java.lang.IllegalStateException: When sending a fragmented message, all fragments bust be of the same type
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:411)
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.endMessage(WsRemoteEndpointImplBase.java:366)
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$IntermediateMessageHandler.onResult(WsRemoteEndpointImplBase.java:513)
	at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer$OnResultRunnable.run(WsRemoteEndpointImplServer.java:247)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Rolling back to 8.0.20 but retaining Tomcat Native 1.1.33 restores error-free webapp operation.  I haven't isolated a simple example as the webapp mostly works and I don't yet know what triggers the error.  The offending function generates new threads, access a database, creates various forms and uses WebSocket to push data to other user interfaces.  I understand I have provided insufficient information to qualify as a bug report, but please take it as a data point, in case you receive other similar reports.
Comment 1 Mark Thomas 2015-03-31 10:44:11 UTC
Are you using perMessageDeflate ?
Comment 2 Mark Thomas 2015-03-31 17:21:06 UTC
Thanks for the report. It was sketchy in terms of reproduction but there was enough information to pin-point a suspect commit. From there it was fairly easy to see what had gone wrong.

A fix for a problem in trunk was incorrect. It fixed the blocking case which was broken in trunk but broke the non-blocking case. The back-port then broke the perMessage-deflate if compression of a single message part resulted in multiple message parts.

The original issue has been fixed in trunk and the regression / incorrect fix reverted in 8.0.x for 8.0.22 onwards and 7.0.x for 7.0.62 onwards.
Comment 3 Steve Demy 2015-03-31 20:43:15 UTC
Thanks Mark for taking the time to convert my limited insight into a solution.
Comment 4 Mark Thomas 2015-04-19 07:38:22 UTC
*** Bug 57831 has been marked as a duplicate of this bug. ***