Skip to content

[Bug] Message sending failure due to timeout on RocketMQ 5.0 Producer Client with Apple M2 chip and OpenJDK 1.8 #6989

@ingdex

Description

@ingdex

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

MacBook Pro (M2 Pro chip)

RocketMQ version

rocketmq-client-java 5.0.4

JDK Version

OpenJDK 1.8

Describe the Bug

Message sending failure due to timeout on RocketMQ 5.0 Producer Client with Apple M2 chip and OpenJDK 1.8.

Steps to Reproduce

  1. Clone repository from https://github.com/apache/rocketmq-clients.git
  2. Send messages with Java client ProducerNormalMessageExample (ENDPOINTS, topic, ACCESS_KEY and SECRET_KEY are set correctly).

What Did You Expect to See?

Messages should be send successfully.

What Did You See Instead?

The errors are as follows:

/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=56818:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home/jre/lib/rt.jar:/Users/yuncun/workspace/rocketmq-clients/java/client/target/classes:/Users/yuncun/workspace/rocketmq-clients/java/client-apis/target/classes:/Users/yuncun/.m2/repository/org/apache/rocketmq/rocketmq-proto/2.0.3/rocketmq-proto-2.0.3.jar:/Users/yuncun/.m2/repository/org/apache/tomcat/annotations-api/6.0.53/annotations-api-6.0.53.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-netty-shaded/1.50.0/grpc-netty-shaded-1.50.0.jar:/Users/yuncun/.m2/repository/com/google/errorprone/error_prone_annotations/2.14.0/error_prone_annotations-2.14.0.jar:/Users/yuncun/.m2/repository/io/perfmark/perfmark-api/0.25.0/perfmark-api-0.25.0.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-core/1.50.0/grpc-core-1.50.0.jar:/Users/yuncun/.m2/repository/com/google/code/gson/gson/2.9.0/gson-2.9.0.jar:/Users/yuncun/.m2/repository/com/google/android/annotations/4.1.1.4/annotations-4.1.1.4.jar:/Users/yuncun/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.21/animal-sniffer-annotations-1.21.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-protobuf/1.50.0/grpc-protobuf-1.50.0.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-api/1.50.0/grpc-api-1.50.0.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-context/1.50.0/grpc-context-1.50.0.jar:/Users/yuncun/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/yuncun/.m2/repository/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-protobuf-lite/1.50.0/grpc-protobuf-lite-1.50.0.jar:/Users/yuncun/.m2/repository/io/grpc/grpc-stub/1.50.0/grpc-stub-1.50.0.jar:/Users/yuncun/.m2/repository/com/google/protobuf/protobuf-java-util/3.21.7/protobuf-java-util-3.21.7.jar:/Users/yuncun/.m2/repository/com/google/protobuf/protobuf-java/3.21.7/protobuf-java-3.21.7.jar:/Users/yuncun/.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar:/Users/yuncun/.m2/repository/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar:/Users/yuncun/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:/Users/yuncun/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/yuncun/.m2/repository/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.jar:/Users/yuncun/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/yuncun/.m2/repository/ch/qos/logback/logback-core/1.2.9/logback-core-1.2.9.jar:/Users/yuncun/.m2/repository/ch/qos/logback/logback-classic/1.2.9/logback-classic-1.2.9.jar:/Users/yuncun/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-api/1.14.0/opentelemetry-api-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-context/1.14.0/opentelemetry-context-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-sdk/1.14.0/opentelemetry-sdk-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-sdk-common/1.14.0/opentelemetry-sdk-common-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-semconv/1.14.0-alpha/opentelemetry-semconv-1.14.0-alpha.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-sdk-trace/1.14.0/opentelemetry-sdk-trace-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-sdk-metrics/1.14.0/opentelemetry-sdk-metrics-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-sdk-logs/1.14.0-alpha/opentelemetry-sdk-logs-1.14.0-alpha.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-exporter-otlp-metrics/1.14.0/opentelemetry-exporter-otlp-metrics-1.14.0.jar:/Users/yuncun/.m2/repository/io/opentelemetry/opentelemetry-exporter-otlp-common/1.14.0/opentelemetry-exporter-otlp-common-1.14.0.jar:/Users/yuncun/.m2/repository/net/javacrumbs/future-converter/future-converter-java8-guava/1.2.0/future-converter-java8-guava-1.2.0.jar:/Users/yuncun/.m2/repository/net/javacrumbs/future-converter/future-converter-common/1.2.0/future-converter-common-1.2.0.jar:/Users/yuncun/.m2/repository/net/javacrumbs/future-converter/future-converter-java8-common/1.2.0/future-converter-java8-common-1.2.0.jar:/Users/yuncun/.m2/repository/net/javacrumbs/future-converter/future-converter-guava-common/1.2.0/future-converter-guava-common-1.2.0.jar org.apache.rocketmq.client.java.example.ProducerNormalMessageExample
Exception in thread "main" java.lang.IllegalStateException: Expected the service ProducerImpl-0 [FAILED] to be RUNNING, but the service has FAILED
	at com.google.common.util.concurrent.AbstractService.checkCurrentState(AbstractService.java:381)
	at com.google.common.util.concurrent.AbstractService.awaitRunning(AbstractService.java:305)
	at com.google.common.util.concurrent.AbstractIdleService.awaitRunning(AbstractIdleService.java:165)
	at org.apache.rocketmq.client.java.impl.producer.ProducerBuilderImpl.build(ProducerBuilderImpl.java:93)
	at org.apache.rocketmq.client.java.example.ProducerSingleton.buildProducer(ProducerSingleton.java:68)
	at org.apache.rocketmq.client.java.example.ProducerSingleton.getInstance(ProducerSingleton.java:75)
	at org.apache.rocketmq.client.java.example.ProducerNormalMessageExample.main(ProducerNormalMessageExample.java:41)
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.952163750s. [buffered_nanos=2955723375, waiting_for_connection]
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567)
	at 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 com.google.common.util.concurrent.AbstractIdleService$DelegateService$1.run(AbstractIdleService.java:62)
	at com.google.common.util.concurrent.Callables.lambda$threadRenaming$3(Callables.java:103)
	at java.lang.Thread.run(Thread.java:748)
Caused by: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.952163750s. [buffered_nanos=2955723375, waiting_for_connection]
	at io.grpc.Status.asRuntimeException(Status.java:539)
	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:544)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:471)
	at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:435)
	at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:468)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:744)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at 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

Process finished with exit code 1

Additional Context

I've found that it takes a long time to initialize the producer before sending a message in debug mode, and the same problem doesn't occur on MacBook Pros and other platforms with the M1 chip. So I'm guessing that the issue is caused by OpenJDK 1.8 running inefficiently on a MacBook Pro with the M2 chip.

Thus, I change the JDK to Oracle 11 and Zulu 11, then the messages are sent successfully.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions