RejectedExecutionException occurs during shutdown if an open websocket session exists

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.3
    • 7.4

Issue

The following message is logged in server.log during shutdown if an open websocket session exists. Frequency is rare and not reproducible.

14:25:50,082 ERROR [org.xnio.listener] (default I/O-4) XNIO001007: A channel event listener threw an exception: java.util.concurrent.RejectedExecutionException: XNIO007007: Thread is terminating
	at org.xnio.nio.WorkerThread.execute(WorkerThread.java:620)
	at io.undertow.websockets.jsr.UndertowSession$3.handleEvent(UndertowSession.java:396)
	at io.undertow.websockets.jsr.UndertowSession$3.handleEvent(UndertowSession.java:388)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:1081)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:1040)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$1.run(AbstractFramedChannel.java:144)
	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)

Resolution

This is a race condition issue already reported as This content is not included.JBEAP-24141/This content is not included.UNDERTOW-2081. The issue is fixed in cumulative patch(CP) JBoss EAP 7.4.9. If this message is logged during shutdown, it is harmless.

Diagnostic Steps

The following byteman rule can reproduce this race condition issue.

RULE UNDERTOW-2081
CLASS io.undertow.websockets.jsr.UndertowSession$3
METHOD handleEvent(io.undertow.websockets.core.WebSocketChannel)
AT ENTRY
IF true
DO
  traceln("### HIT BYTEMAN");
  Thread.sleep(100);
ENDRULE
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.