spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.55k stars 3.33k forks source link

Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalArgumentException: WebSocket close status code does NOT comply with RFC-6455: 1006 #2624

Open wajncn opened 2 years ago

wajncn commented 2 years ago

Describe the bug

Versoin org.springframework.cloud:2021.0.0 and 2021.0.3-SNAPSHOT is exist problem。 version Hoxton.RELEASE is normal。

Not config is property  `spring.cloud.gateway.httpclient.websocket.max-frame-payload-length`  
is throw `WebSocket close status code does NOT comply with RFC-6455: 1006`
java.lang.IllegalArgumentException: WebSocket close status code does NOT comply with RFC-6455: 1006`   
```java
reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalArgumentException: WebSocket close status code does NOT comply with RFC-6455: 1006
Caused by: java.lang.IllegalArgumentException: WebSocket close status code does NOT comply with RFC-6455: 1006
    at io.netty.handler.codec.http.websocketx.CloseWebSocketFrame.requireValidStatusCode(CloseWebSocketFrame.java:209) ~[netty-codec-http-4.1.72.Final.jar:4.1.72.Final]
    at io.netty.handler.codec.http.websocketx.CloseWebSocketFrame.<init>(CloseWebSocketFrame.java:69) ~[netty-codec-http-4.1.72.Final.jar:4.1.72.Final]
    at reactor.netty.http.client.WebsocketClientOperations.sendClose(WebsocketClientOperations.java:213) ~[reactor-netty-http-1.0.14.jar:1.0.14]
    at org.springframework.web.reactive.socket.adapter.ReactorNettyWebSocketSession.close(ReactorNettyWebSocketSession.java:124) ~[spring-webflux-5.3.14.jar:5.3.14]
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:125) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxFilter$FilterSubscriber.onNext(FluxFilter.java:113) [reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:220) [reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxFirstWithSignal$FirstEmittingSubscriber.onNext(FluxFirstWithSignal.java:330) [reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.Operators$MonoInnerProducerBase.complete(Operators.java:2634) [reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.SinkOneMulticast.tryEmitValue(SinkOneMulticast.java:70) [reactor-core-3.4.13.jar:3.4.13]
    at reactor.netty.http.server.WebsocketServerOperations.sendCloseNow(WebsocketServerOperations.java:258) [reactor-netty-http-1.0.14.jar:1.0.14]
    at reactor.netty.http.server.WebsocketServerOperations.onInboundCancel(WebsocketServerOperations.java:191) [reactor-netty-http-1.0.14.jar:1.0.14]
    at reactor.netty.channel.FluxReceive.unsubscribeReceiver(FluxReceive.java:476) [reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.netty.channel.FluxReceive.lambda$new$0(FluxReceive.java:87) [reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.netty.channel.FluxReceive.cancelReceiver(FluxReceive.java:194) [reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.netty.channel.FluxReceive.cancel(FluxReceive.java:97) [reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.core.publisher.FluxFilter$FilterSubscriber.cancel(FluxFilter.java:191) [reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxMap$MapSubscriber.cancel(FluxMap.java:167) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxMap$MapSubscriber.cancel(FluxMap.java:167) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.cancel(FluxPeek.java:153) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.cancel(FluxPeek.java:153) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.cancel(FluxPeek.java:153) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxMap$MapSubscriber.cancel(FluxMap.java:167) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.Operators.terminate(Operators.java:1240) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.netty.channel.MonoSendMany$SendManyInner.cancel(MonoSendMany.java:167) ~[reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.core.publisher.Operators.terminate(Operators.java:1240) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.MonoZip$ZipInner.cancel(MonoZip.java:372) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.MonoZip$ZipCoordinator.cancelExcept(MonoZip.java:270) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.MonoZip$ZipInner.onError(MonoZip.java:349) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.netty.channel.MonoSendMany$SendManyInner.run(MonoSendMany.java:351) ~[reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.netty.channel.MonoSendMany$SendManyInner.trySchedule(MonoSendMany.java:422) ~[reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.netty.channel.MonoSendMany$SendManyInner.onError(MonoSendMany.java:198) ~[reactor-netty-core-1.0.14.jar:1.0.14]
    at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:132) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:222) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:222) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:222) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:132) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:132) ~[reactor-core-3.4.13.jar:3.4.13]
    at reactor.core.publisher.FluxFilter$FilterSubscriber.onError(FluxFilter.java:157) [reactor-core-3.4.13.jar:3.4.13]

**bug config max-frame-payload-length is large enough is not error eg spring.cloud.gateway.httpclient.websocket.max-frame-payload-length=1M

wajncn commented 2 years ago

i try version 2021.0.3-SNAPSHOT and 2021.0.0 gonna be an error

Niels-Abel commented 2 years ago

We see this bug in version 2021.0.2 too. Closed issue from reactor-netty: https://github.com/reactor/reactor-netty/issues/1891

5s2j0f6c8k commented 2 years ago

My version 2021.0.1 also has this error

hwy425 commented 2 years ago

I also face this error in 2021.0.3, and i have configuration spring.cloud.gateway.httpclient.websocket.max-frame-payload-length=10485760

markr512 commented 2 years ago

I also face this error in 2021.0.3 with error code 1005

aboccag commented 2 years ago

Same here, using spring boot / webflux (2.7.1) and cloud gateway 2021.0.3

java.lang.IllegalArgumentException: WebSocket close status code does NOT comply with RFC-6455: 1005
vaibhavbhootna commented 2 years ago

I am also facing this issue with the spring cloud gateway. version: 2021.0.3

vitdo82 commented 1 year ago

The same problem with Spring Cloud 2022.0.1 version

emirhannaneli commented 1 year ago

The problem still persists in Spring Cloud version 2022.0.2. I am using SockJS as client.