diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java index f483ca0c6e..b47ec0fca2 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -240,6 +240,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE BufferingStompDecoder decoder = this.decoders.get(session.getId()); if (decoder == null) { + if (!session.isOpen()) { + logger.trace("Dropped inbound WebSocket message due to closed session"); + return; + } throw new IllegalStateException("No decoder for session id '" + session.getId() + "'"); }