rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED

Open DJuR opened this issue 2 years ago • 27 comments

code:

 public static void main(String[] args) throws ClientException {
        String endpoint = "localhost:9876";
        String topic = "TopicTest";

        ClientServiceProvider clientServiceProvider = ClientServiceProvider.loadService();
        ClientConfigurationBuilder clientConfigurationBuilder = ClientConfiguration.newBuilder().setEndpoints(endpoint);
        ClientConfiguration build = clientConfigurationBuilder.build();
        Producer producer = clientServiceProvider.newProducerBuilder().setTopics(topic)
                .setClientConfiguration(build)
                .build();

        Message message = clientServiceProvider.newMessageBuilder()
                .setTag(topic)
                .setKeys("messageKey")
                .setTag("messageTag")
                .setBody("messageBody".getBytes(StandardCharsets.UTF_8))
                .build();

        SendReceipt send = producer.send(message);
        System.out.println(send.getMessageId());

    }

Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]

DJuR avatar Feb 08 '23 09:02 DJuR

I have got the same problem.

Guts17 avatar Feb 09 '23 09:02 Guts17

It seems to be a common problem on windows.

Guts17 avatar Feb 09 '23 09:02 Guts17

ALPN negotiation is not successful in some platform, it is related to the TLS part of gRPC.

we plan to provide the TLS options recently so that you could turn it off.

aaron-ai avatar Feb 09 '23 09:02 aaron-ai

Is there some advice ? I have the problem too.

jiangyklala avatar Mar 31 '23 15:03 jiangyklala

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false).

Here is the related link.

aaron-ai avatar Mar 31 '23 15:03 aaron-ai

package org.apache.rocketmq.client.apis.ClientConfigurationBuilder

Which version of SDK is this class under?

I'm using "rocketmq-client-java-5.0.4.jar"

gongzh021 avatar Apr 15 '23 06:04 gongzh021

package org.apache.rocketmq.client.apis.ClientConfigurationBuilder

Which version of SDK is this class under?

I'm using "rocketmq-client-java-5.0.4.jar"

5.0.5

aaron-ai avatar Apr 15 '23 06:04 aaron-ai

package org.apache.rocketmq.client.apis.ClientConfigurationBuilder Which version of SDK is this class under? I'm using "rocketmq-client-java-5.0.4.jar"

5.0.5

I still can't seem to use the SDK of 5.0.5.

ERROR:

Exception in thread "main" java.lang.IllegalStateException: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:381) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:305) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:165) at org.apache.rocketmq.client.java.impl.producer.ProducerBuilderImpl.build(ProducerBuilderImpl.java:93) at rocketmq_0415.ProducerExample.main(ProducerExample.java:29) Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91) at org.apache.rocketmq.client.java.impl.ClientImpl.startUp(ClientImpl.java:188) at org.apache.rocketmq.client.java.impl.producer.ProducerImpl.startUp(ProducerImpl.java:114) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.Callables.lambda$threadRenaming$3(Callables.java:103) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason at org.apache.rocketmq.shaded.io.grpc.Status.asRuntimeException(Status.java:539) at org.apache.rocketmq.shaded.io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:544) at org.apache.rocketmq.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) at org.apache.rocketmq.shaded.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at org.apache.rocketmq.shaded.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more

gongzh021 avatar Apr 15 '23 07:04 gongzh021

@gongzh021 You may need to upgrade to the latest server version, as not all server versions support disabling SSL.

aaron-ai avatar Apr 15 '23 07:04 aaron-ai

@gongzh021 You may need to upgrade to the latest server version, as not all server versions support disabling SSL.

I would like to ask, is this a problem only in the new version, or is this a problem in all versions?

gongzh021 avatar Apr 15 '23 07:04 gongzh021

@gongzh021 You may need to upgrade to the latest server version, as not all server versions support disabling SSL.

I would like to ask, is this a problem only in the new version, or is this a problem in all versions?

This is theoretically an issue that only appears in relatively old server and client versions, and currently most of them are seen on Windows platforms.

aaron-ai avatar Apr 15 '23 07:04 aaron-ai

I meet this problem too, but my situtation is the broker and nameServer run on my Cloud Server, and Client run on my MAC. The problem appear beacuse the broker send the intranet address to nameServer, so my MAC cannot connect it.

The way I solve the problem is I add these to the 'broker.conf'-- brokerIP1=... brokerIP2=... namesrvAddr=localhost:9876

and you should change ... to your public address.

To know more detail infomation, please check this blog from chinese website:https://blog.csdn.net/jpf254/article/details/80748021

I dont know the final reason why that can solve the problem, I need to see the source code!

KevinWang12138 avatar Apr 30 '23 14:04 KevinWang12138

I have got the same problem.

plutoyty avatar May 18 '23 13:05 plutoyty

I have got the same problem.

Exception in thread "main" java.lang.IllegalStateException: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:381) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:305) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:165) at org.apache.rocketmq.client.java.impl.producer.ProducerBuilderImpl.build(ProducerBuilderImpl.java:93) at RocketMQ.ProducerExample.main(ProducerExample.java:31) Caused by: java.util.concurrent.ExecutionException: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0] at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91) at org.apache.rocketmq.client.java.impl.ClientImpl.startUp(ClientImpl.java:188) at org.apache.rocketmq.client.java.impl.producer.ProducerImpl.startUp(ProducerImpl.java:114) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62) at org.apache.rocketmq.shaded.com.google.common.util.concurrent.Callables.lambda$threadRenaming$3(Callables.java:103) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.rocketmq.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0] at org.apache.rocketmq.shaded.io.grpc.Status.asRuntimeException(Status.java:539) at org.apache.rocketmq.shaded.io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:544) at org.apache.rocketmq.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at org.apache.rocketmq.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744) at org.apache.rocketmq.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) at org.apache.rocketmq.shaded.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at org.apache.rocketmq.shaded.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more

plutoyty avatar May 18 '23 13:05 plutoyty

我们项目中使用canal监听binlog,当数据写入rocket后, 消费时项目无法启动,报错如下: image 目前rocket安装在测试机上,配置文件没有限制http或https请求方式,我们使用的rocket版本是5.0.4,无法设置enablessl选项,请教大佬目前情况该怎么解决,谢谢

lipeimin avatar Jun 07 '23 09:06 lipeimin

rocket版本是升级到 5.0.5

jc0803kevin avatar Jul 04 '23 03:07 jc0803kevin

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false).

Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency>

image image image

服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

AI1186780944 avatar Jul 31 '23 15:07 AI1186780944

你安装的rocketmq 的客户端的版本是多少?

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年7月31日(星期一) 晚上11:50 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [apache/rocketmq] Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED (Issue #6015)

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false).

Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

jc0803kevin avatar Aug 01 '23 01:08 jc0803kevin

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency>

image image image

服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

jc0803kevin avatar Aug 01 '23 02:08 jc0803kevin

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency> image image image 服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

我使用的是Local模式启动的。并且日志显示proxy启动是成功的。就是没有使用账户和密码。这个账户和密码是必须的么?正常来说内网环境不是无需设置ACL么?我的JDK环境版本是20.x。之前使用Remoting协议的SDK是链接正常的。可以正常收发消息。但是gRPC协议的不行。 image 是否需要我提供我的测试代码来方便你们测试?

AI1186780944 avatar Aug 01 '23 04:08 AI1186780944

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency> image image image 服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

我使用的是Local模式启动的。并且日志显示proxy启动是成功的。就是没有使用账户和密码。这个账户和密码是必须的么?正常来说内网环境不是无需设置ACL么?我的JDK环境版本是20.x。之前使用Remoting协议的SDK是链接正常的。可以正常收发消息。但是gRPC协议的不行。 image 是否需要我提供我的测试代码来方便你们测试?

没有设置账户密码,是可以不填的。连接使用的端口是proxy的端口,不是9876. 例如proxy.json配置为 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" }

那连接的 endpoints = "localhost:18082"

jc0803kevin avatar Aug 01 '23 09:08 jc0803kevin

grpcServerPort

非常感谢。按照您的方案,已经解决了这个问题。

AI1186780944 avatar Aug 01 '23 10:08 AI1186780944

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

01codingworld avatar Aug 10 '23 15:08 01codingworld

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

麻烦死了,我去用Kafka了

ipyton avatar Mar 09 '24 04:03 ipyton

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

我也遇到了UNAVAILABLE: Network closed for unknown reason,用你的这个方法修改好了

bruce256 avatar Aug 01 '24 05:08 bruce256

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

官方文档里的部署真的不知道介绍了个啥, 部署起来稍微要改一点配置信息都不知道去哪里找, 全靠搜

MmringZee avatar Aug 01 '24 12:08 MmringZee

Is there some advice ? I have the problem too.

@jiangyklala This issue is actually caused by SSL compatibility problems on some Windows platforms. Please disable ssl by ClientConfigurationBuilder#enableSsl(false). Here is the related link.

按照你的解决方案进行了处理,但是错误变成了”UNAVAILABLE: Network closed for unknown reason“。如果不设置enableSsl=false,这错误是”UNAVAILABLE: Failed ALPN negotiation: Unable to find compatible protocol“。 SDK版本是rocketmq-client-java 5.0.5。服务器端是5.1.3的。 <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client-java</artifactId> <version>5.0.5</version> </dependency> image image image 服务器是Ubuntu虚拟机搭建的。url是虚拟机IP:9876。在SpringCloud项目启动注册消费者Bean的时候,报的错误。

rocketmq 5.x 需要使用 proxy 的的方式启动。然后enableSsl=false, 加上对应的账户密码。就可以连接。

我使用的是Local模式启动的。并且日志显示proxy启动是成功的。就是没有使用账户和密码。这个账户和密码是必须的么?正常来说内网环境不是无需设置ACL么?我的JDK环境版本是20.x。之前使用Remoting协议的SDK是链接正常的。可以正常收发消息。但是gRPC协议的不行。 image 是否需要我提供我的测试代码来方便你们测试?

没有设置账户密码,是可以不填的。连接使用的端口是proxy的端口,不是9876. 例如proxy.json配置为 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" }

那连接的 endpoints = "localhost:18082"

如果使用rocketmq-client sdk,应该是使用proxy中grpc端口 例如 10.0.0.1 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" } 10.0.0.2 { "grpcServerPort": 18081, "remotingListenPort":18082, "rocketMQClusterName": "DefaultCluster" } String ENDPOINTS = "10.0.0.1:18081;10.0.0.2:18081"; 虽然用remoting一样可以成功 1725781300171

EightyOliveira avatar Sep 08 '24 07:09 EightyOliveira

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

请问如何设置 proxy 地址端口 呢?

lixianli1987 avatar Dec 26 '24 07:12 lixianli1987

我的代码经过验证发现与 enableSsl=false 无关,主要是 endpoint 指定了错误的地址 nameserver(localhost:9876), 把 endpoint 指定为 proxy 地址端口,以上两个报错都解决了 另外,rocketmq 5.x 需要使用 proxy 的的方式启动, 希望文档能更细化完善

请问如何设置 proxy 地址端口 呢?

Configure it in rmq-proxy.json, and then use -pc to specify the path to proxy.json when starting the deployment

MmringZee avatar Jan 03 '25 14:01 MmringZee