java.nio.channels.ClosedChannelException is thrown for remote EJB calls that take longer than 60 seconds
Issue
- If a remote EJB call takes longer than 60 seconds, the TCP connection is closed from server-side when 60 seconds have elapsed since the start of the remote EJB request. We can see the following stack trace in the remote EJB client-side and no response is returned from server-side.
Exception in thread "main" javax.ejb.EJBException: java.nio.channels.ClosedChannelException
at org.jboss.ejb.protocol.remote.EJBClientChannel$MethodInvocation.handleClosed(EJBClientChannel.java:1287)
at org.jboss.remoting3.util.InvocationTracker.connectionClosed(InvocationTracker.java:222)
at org.jboss.remoting3.util.InvocationTracker.lambda$new$0(InvocationTracker.java:70)
at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:50)
at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:520)
at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:425)
at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:286)
at org.jboss.remoting3.remote.RemoteConnectionChannel.closeAction(RemoteConnectionChannel.java:510)
at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeAsync(AbstractHandleableCloseable.java:368)
at org.jboss.remoting3.remote.RemoteConnectionHandler.closeAllChannels(RemoteConnectionHandler.java:623)
at org.jboss.remoting3.remote.RemoteConnectionHandler.receiveCloseRequest(RemoteConnectionHandler.java:226)
at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:97)
at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:51)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: java.nio.channels.ClosedChannelException
... 17 more
- The undertow http-listener has
write-timeout
attribute in standalone.xml. Ifwrite-timeout
is set to undefined same as default, this issue is no longer reproduced]
<http-listener name="default" write-timeout="60000" socket-binding="http" redirect-socket="https" enable-http2="true"/>
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.4
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.