Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1097763

Summary: WebSocket: java.lang.IndexOutOfBoundsException
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Michal Haško <mhasko>
Component: WebAssignee: Rémy Maucherat <rmaucher>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hatlapatka <rhatlapa>
Severity: high Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.3.0CC: kkhan, mvelas, pslavice
Target Milestone: ER10   
Target Release: EAP 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-31 15:38:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Haško 2014-05-14 13:28:22 UTC
Description of problem:
The whiteboard websocket example from the javaee7 samples [1] produces java.lang.IndexOutOfBoundsException

[1] https://github.com/javaee-samples/javaee7-samples/tree/master/websocket/whiteboard

Version-Release number of selected component (if applicable):
jboss-eap-6.3.0.ER4.zip

How reproducible:
100%

Steps to Reproduce:
1. Download the whiteboard websocket sample [1]
2. build a war: 'mvn package -DskipTests'
3. add jboss-web.xml to the war /WEB-INF (see [2])
4. start EAP6.3.0.ER4
5. enable the NIO2 protocol (see [3]), don't forget to reload the server
6. deploy the whiteboard.war app
7. open http://localhost:8080/whiteboard in two separate browsers
8. deselect the "Online" checkbox and draw some shapes in the whiteboard
9. click "Snapshot"

[2] http://blog.arungupta.me/2014/05/websocket-jboss-eap-6-3/
[3] http://documentation-devel.engineering.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.3/html-single/Development_Guide/index.html#Create_a_Websocket_Application

Actual results:
Exception in server log:
15:10:21,865 ERROR [stderr] (http-/127.0.0.1:8080-34) Exception in thread "http-/127.0.0.1:8080-34" java.lang.IndexOutOfBoundsException
15:10:21,866 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at java.nio.Buffer.checkBounds(Buffer.java:559)
15:10:21,866 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:259)
15:10:21,867 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at org.apache.coyote.http11.InternalNioInputBuffer$1.completed(InternalNioInputBuffer.java:121)
15:10:21,867 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at org.apache.coyote.http11.InternalNioInputBuffer$1.completed(InternalNioInputBuffer.java:110)
15:10:21,867 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at org.apache.tomcat.util.net.NioChannel$1.completed(NioChannel.java:671)
15:10:21,867 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at org.apache.tomcat.util.net.NioChannel$1.completed(NioChannel.java:667)
15:10:21,868 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
15:10:21,868 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at sun.nio.ch.Invoker$2.run(Invoker.java:218)
15:10:21,868 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
15:10:21,869 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
15:10:21,869 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
15:10:21,869 ERROR [stderr] (http-/127.0.0.1:8080-34) 	at java.lang.Thread.run(Thread.java:744)

Expected results:
The picture from the whiteboard is transferred to the whiteboard on the other browser.

Comment 1 Rémy Maucherat 2014-05-15 11:31:23 UTC
The scenario described is a bit convoluted, but the stack trace gives some info. Code seems to be missing for the non blocking IO that could be causing the exception, so I am trying r2412.

Comment 2 Martin Velas 2014-07-31 15:38:07 UTC
This issue reported (and also reproduced) against older version EAP 6.3.0.ER4 cannot be reproduced against latest 6.3.0.ER10 bits (with JBossWeb 7.4.8), which means it was fixed earlier. Therefore, we are closing this bug. Thank you for reporting this issue.