Bug 1104139 - WebSockets implementation should provide a way to increase TIMEOUT value
Summary: WebSockets implementation should provide a way to increase TIMEOUT value
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER6
: EAP 6.4.0
Assignee: Rémy Maucherat
QA Contact: Michael Cada
URL:
Whiteboard:
Depends On: 1104206
Blocks: 1104203 1106492
TreeView+ depends on / blocked
 
Reported: 2014-06-03 11:20 UTC by sgilda
Modified: 2019-08-19 12:46 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
: 1106492 (view as bug list)
Environment:
Last Closed: 2019-08-19 12:46:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Reproducer (20.76 KB, application/zip)
2014-06-13 14:11 UTC, Radim Hatlapatka
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1097450 0 unspecified CLOSED websockets timeout is SHORT 2021-02-22 00:41:40 UTC

Internal Links: 1097450

Description sgilda 2014-06-03 11:20:50 UTC
Description of problem:
My understanding is that there is no ways to change the default timeout of 20 seconds in the current implementation. This is extremely short.

Apache Tomcat WebSocket specification provides a way to do this by setting the property org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT in the user properties collection attached to the WebSocket session. It also allows for other configurations, such as binary buffer size and text buffer size.

More information about configuration options is located in the following locations:
http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html
http://tomcat.apache.org/tomcat-8.0-doc/web-socket-howto.html


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Rémy Maucherat 2014-06-03 12:18:14 UTC
Tomcat uses an infinite timeout for upgraded connections, so trying that for NIO2 (APR is more complex for timeout and I cannot immediately do it).
r2441

Comment 2 Radim Hatlapatka 2014-06-13 13:58:24 UTC
It is not working for me (checking with EAP 6.3.0.ER7)

1) I haven't found a way to change the timeout value (and per discussion with Remy on IRC it shouldn't be possible to change)

2) I am still getting 20 s timeout as you can see from timestamps in the log:

15:44:08,572 INFO  [stdout] (http-/127.0.0.1:8080-11) WebSocket opened: 0
15:44:13,515 INFO  [stdout] (http-/127.0.0.1:8080-15) Say hello to 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
15:44:14,277 INFO  [stdout] (http-/127.0.0.1:8080-114) Closing a WebSocket due to null
15:44:14,948 INFO  [stdout] (http-/127.0.0.1:8080-117) WebSocket opened: 1
15:44:20,861 INFO  [stdout] (http-/127.0.0.1:8080-122) Say hello to 'dsafdsaffffffffdwfasddfsafasdfasdfa'
15:44:40,878 ERROR [org.apache.tomcat.websocket] (http-/127.0.0.1:8080-122) JBWEB008809: No error handling configured for [org.jboss.as.quickstarts.websocket_hello.HelloName] and the following error occurred: java.lang.IllegalArgumentException: java.lang.reflect.InvocationTargetException
	at org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBase.onMessage(PojoMessageHandlerWholeBase.java:89) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:369) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:466) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:271) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:115) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:54) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:169) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.core.StandardWrapperValve.async(StandardWrapperValve.java:585) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.core.StandardWrapperValve.event(StandardWrapperValve.java:350) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.core.StandardContextValve.event(StandardContextValve.java:171) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.valves.ValveBase.event(ValveBase.java:185) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.core.StandardHostValve.event(StandardHostValve.java:247) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.valves.ValveBase.event(ValveBase.java:185) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.core.StandardEngineValve.event(StandardEngineValve.java:121) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.catalina.connector.CoyoteAdapter.event(CoyoteAdapter.java:228) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.coyote.http11.Http11NioProcessor.event(Http11NioProcessor.java:230) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.event(Http11NioProtocol.java:818) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.util.net.NioEndpoint$ChannelProcessor.run(NioEndpoint.java:935) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
	at org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBase.onMessage(PojoMessageHandlerWholeBase.java:85) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	... 20 more
Caused by: java.io.IOException: java.util.concurrent.TimeoutException
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:216) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:157) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.jboss.as.quickstarts.websocket_hello.HelloName.sayHello(HelloName.java:19) [classes:]
	... 25 more
Caused by: java.util.concurrent.TimeoutException
	at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:115) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:209) [jbossweb-7.4.5.Final-redhat-1.jar:7.4.5.Final-redhat-1]
	... 28 more

Comment 3 Rémy Maucherat 2014-06-13 14:07:29 UTC
Ok, so 20s is more than enough then for this particular timeout (a single *write* operation) and it doesn't need configuration.

The Tomcat impl allows setting a org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT a user property in the web socket session, but I don't think it should be used, either the application or the container has an issue.

Comment 4 Radim Hatlapatka 2014-06-13 14:11:52 UTC
Created attachment 908594 [details]
Reproducer

To reproduce:
1) start EAP with enabled NIO2 connector
2) build and deploy attached reproducer
3) go to http://localhost:8080/websocket-documentation/
4) open connection, send message, close connection
5) wait 20s and watch the server log

Comment 5 Martin Velas 2014-08-04 12:36:46 UTC
Issue is still valid for EAP 6.3.0.ER10 bits.

Comment 6 Rémy Maucherat 2014-09-04 13:44:26 UTC
I still don't understand the purpose of modifying the timeout, it is not a good idea to block more than the default 20s. If actually needed, the code is the same as in Tomcat, and can use the blocking send attribute in the user session.

In Tomcat 7 or 8, users have yet to ask for an additional configuration mechanism, such as a system property to change the default.

As a result, I don't see any need to address this issue further.


Note You need to log in before you can comment on or make changes to this bug.