Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client receive error when using socks5 proxy #1040

Open
wxq1990 opened this issue Mar 4, 2022 · 1 comment
Open

client receive error when using socks5 proxy #1040

wxq1990 opened this issue Mar 4, 2022 · 1 comment

Comments

@wxq1990
Copy link

wxq1990 commented Mar 4, 2022

 var tcpClient = TcpClient.create()
                .host(serverHost)
                .port(serverPort);
        var proxyHost = rSocketClientProps.getProxyHost();
        var proxyPort = rSocketClientProps.getProxyPort();
        if (StringUtils.hasText(proxyHost)) {
            tcpClient=tcpClient.proxy(p -> p.type(ProxyProvider.Proxy.SOCKS5)
                        .host(proxyHost)
                        .port(proxyPort));
        }
        log.info("[RSocketClient] connecting {}:{}", serverHost, serverPort);
        RSocketConnector.create()
                .acceptor(new RSocketClientAcceptor(this, SpringUtil.getBean(RSocketClientHandler.class)))
               // .resume(resume)
                .connect(TcpClientTransport.create(tcpClient))
                .doOnError(e -> log.error("[RSocketClient] connect error", e))
                .doOnSuccess(s -> {
                    setClient(s);
                    publisher.publishEvent(new ControlConnected(this));
                    log.info("[RSocketClient] connected {}:{}", serverHost, serverPort);
                })
                .doFinally(s -> log.info("[RSocketClient] connect doFinally {}", s))
                .subscribe();

Error Log

2022-03-04 15:58:36.172 ERROR 4740 --- [actor-tcp-nio-1] c.p.c.a.r.client.RSocketClientAcceptor : [RSocketClient] sendingSocket doOnError

io.rsocket.exceptions.InvalidSetupException: SETUP or RESUME frame must be received before any others
at io.rsocket.exceptions.Exceptions.from(Exceptions.java:58) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.RSocketRequester.lambda$tryTerminateOnZeroError$4(RSocketRequester.java:313) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.RSocketRequester.tryTerminate(RSocketRequester.java:318) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.RSocketRequester.tryTerminateOnZeroError(RSocketRequester.java:313) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.RSocketRequester.handleStreamZero(RSocketRequester.java:224) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.RSocketRequester.handleIncomingFrames(RSocketRequester.java:209) ~[rsocket-core-1.1.1.jar:na]
at reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) ~[reactor-core-3.4.14.jar:3.4.14]
at io.rsocket.core.ClientServerInputMultiplexer$InternalDuplexConnection.onNext(ClientServerInputMultiplexer.java:248) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.ClientServerInputMultiplexer.onNext(ClientServerInputMultiplexer.java:129) ~[rsocket-core-1.1.1.jar:na]
at io.rsocket.core.ClientServerInputMultiplexer.onNext(ClientServerInputMultiplexer.java:48) ~[rsocket-core-1.1.1.jar:na]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) ~[reactor-core-3.4.14.jar:3.4.14]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) ~[reactor-core-3.4.14.jar:3.4.14]
at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:364) ~[reactor-netty-core-1.0.15.jar:1.0.15]
at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:404) ~[reactor-netty-core-1.0.15.jar:1.0.15]
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93) ~[reactor-netty-core-1.0.15.jar:1.0.15]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) ~[netty-codec-4.1.73.Final.jar:4.1.73.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) ~[netty-codec-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.handler.proxy.ProxyHandler.channelRead(ProxyHandler.java:252) ~[netty-handler-proxy-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) ~[netty-transport-4.1.73.Final.jar:4.1.73.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[netty-common-4.1.73.Final.jar:4.1.73.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.73.Final.jar:4.1.73.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.73.Final.jar:4.1.73.Final]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

Your Environment

  • RSocket version(s) used: 1.1.1
  • Other relevant libraries versions (eg. netty, ...): io.rsocket:rsocket-transport-netty:1.1.1
  • Platform (eg. JVM version (javar -version) or Node version (node --version)): java17
  • OS and version (eg uname -a): win10
pderop added a commit to reactor/reactor-netty that referenced this issue Mar 24, 2022
… used (#2120)

Converts any MonoSendMany.SendManyInner ChannelPromise into unvoided ChannelPromise in case a SOCKS proxy is used.

Related to rsocket/rsocket-java#1040
@wxq1990
Copy link
Author

wxq1990 commented Jun 16, 2022

I found another problem, when using a socks proxy and setting resume, although it is not connected to the remote RSocket server, the client shows that the connection is successful(doOnSuccess is called)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant