If Tomcat tryes to send large enough message thought websoket (I've tested binary messages) not to fit into 20 sec timeout, session is closed with null reason. "null" reason goes from org.apache.tomcat.websocket.FutureToSendHandler.get(long, TimeUnit) method, which throws "TimeoutException" constructed with default constructor. Later, in org.apache.tomcat.websocket.WsRemoteEndpointImplBase.handleSendFailureWithEncode(Throwable) CloseReason object is created, calling t.getMessage(), which returns null. The expected behaviour is not to report null close reason, but instead report, that operation timed out.
Thanks for the report. This has been fixed in the following versions: 9.0.x for 9.0.0.M10 onwards 8.5.x for 8.5.5 onwards 8.0.x for 8.0.37 onwards 7.0.x for 7.0.71 onwards