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

On Spring 3.2.7 and above it throws INTERNAL: Encountered end-of-stream mid-frame #862

Closed
namero999 opened this issue Jul 3, 2024 · 11 comments · Fixed by #868 or #918
Closed

On Spring 3.2.7 and above it throws INTERNAL: Encountered end-of-stream mid-frame #862

namero999 opened this issue Jul 3, 2024 · 11 comments · Fixed by #868 or #918

Comments

@namero999
Copy link
Contributor

Describe the bug

A simple worker activation produces the error INTERNAL: Encountered end-of-stream mid-frame

To Reproduce

Use spring >= 3.2.7 with latest version of Spring-Zeebe. In 3.2.7, netty is upgraded. Maybe it's related to that...

Expected behavior

No errors in logs

Log/Stacktrace

Full Stacktrace

2024-07-03T17:04:40.089+02:00  WARN 13712 --- [ault-executor-0] io.camunda.zeebe.client.job.poller       : Failed to activate jobs for worker kakfaProducerWorker#produce and job type kafka-producer

io.grpc.StatusRuntimeException: INTERNAL: Encountered end-of-stream mid-frame
	at io.grpc.Status.asRuntimeException(Status.java:533) ~[grpc-api-1.62.2.jar:1.62.2]
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481) ~[grpc-stub-1.62.2.jar:1.62.2]
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:574) ~[grpc-core-1.62.2.jar:1.62.2]
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:72) ~[grpc-core-1.62.2.jar:1.62.2]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742) ~[grpc-core-1.62.2.jar:1.62.2]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723) ~[grpc-core-1.62.2.jar:1.62.2]
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.62.2.jar:1.62.2]
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.62.2.jar:1.62.2]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]

Environment:

  • OS: MacOs
  • Deployment: SM
  • Spring-Zeebe Version: 8.5.7
  • SpringBoot Version: 3.2.7
  • Configuration: Only ES exporter, no connectors
@sephiroth-j
Copy link

sephiroth-j commented Jul 11, 2024

We observed something similar with Zeebe 8.4.9.

stacktrace for http2 exception
io.grpc.StatusRuntimeException: INTERNAL: http2 exception
	at io.grpc.Status.asRuntimeException(Status.java:537)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:574)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:72)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)
	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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: io.netty.handler.codec.http2.Http2Exception: Received frame of type 1 while processing headers on stream 139.
	at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:107)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.verifyNotProcessingHeaders(DefaultHttp2FrameReader.java:763)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.verifyHeadersFrame(DefaultHttp2FrameReader.java:291)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.verifyFrameState(DefaultHttp2FrameReader.java:203)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:163)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:39)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:186)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:391)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:451)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	... 1 common frames omitted
stacktrace for Encountered end-of-stream mid-frame
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: INTERNAL: Encountered end-of-stream mid-frame
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.join(ZeebeClientFutureImpl.java:72)
	... 4 more
Caused by: io.grpc.StatusRuntimeException: INTERNAL: Encountered end-of-stream mid-frame
	at io.grpc.Status.asRuntimeException(Status.java:537)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:574)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:72)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)
	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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

This is due to an incompatibility of the old version of grpc-java with Netty version 4.1.111, which is shipped with Spring Boot 3.2.7. The versions 1.64.1 and 1.65.0 of grpc-java contain the necessary compatibility fixes for Netty 4.1.111 - see https://github.com/grpc/grpc-java/releases/tag/v1.64.1 and https://github.com/grpc/grpc-java/releases/tag/v1.65.0.

As a workaround, you could use a newer version of grpc by adding the following parts to the dependencyManagement section of you pom. I am pretty sure that this will also work for Zeebe 8.5.

			<dependency>
				<groupId>io.grpc</groupId>
				<artifactId>grpc-stub</artifactId>
				<version>1.65.0</version>
			</dependency>
			<dependency>
				<groupId>io.grpc</groupId>
				<artifactId>grpc-core</artifactId>
				<version>1.65.0</version>
			</dependency>
			<dependency>
				<groupId>io.grpc</groupId>
				<artifactId>grpc-api</artifactId>
				<version>1.65.0</version>
			</dependency>
			<dependency>
				<groupId>io.grpc</groupId>
				<artifactId>grpc-netty</artifactId>
				<version>1.65.0</version>
			</dependency>
			<dependency>
				<groupId>io.grpc</groupId>
				<artifactId>grpc-util</artifactId>
				<version>1.65.0</version>
			</dependency>
			<dependency>
				<groupId>io.grpc</groupId>
				<artifactId>grpc-protobuf</artifactId>
				<version>1.65.0</version>
			</dependency>

CC: @jonathanlukas

@jonathanlukas
Copy link
Collaborator

Hello @sephiroth-j ,
thank you for raising awareness and providing a workaround. As spring-zeebe does not manage the grpc-* dependencies, this should be raised with the zeebe repo.

I will take this to them internally and link the issue once created.

@billbarni
Copy link

This issue is still happening.

Spring Zeebe 8.5.9 and Spring Boot 3.3.2

@jonathanlukas
Copy link
Collaborator

@billbarni which grpc dependency versions are pulled in for your project?

@jonathanlukas jonathanlukas reopened this Aug 19, 2024
@billbarni
Copy link

gRPC 1.62.2 it seems

image

@namero999
Copy link
Contributor Author

We fixed with implementation(platform("io.grpc:grpc-bom:1.66.0")) till the deps in spring-zeebe get updated.

@jonathanlukas
Copy link
Collaborator

Just to manage expectations here: spring-zeebe does not pull in any of these dependency versions. I would advise you to manage the effective dependency version in your own project.

@billbarni
Copy link

Possibly just add this information to the README.

@jonathanlukas
Copy link
Collaborator

@billbarni good idea, I will do that.

@namero999
Copy link
Contributor Author

Just to manage expectations here: spring-zeebe does not pull in any of these dependency versions. I would advise you to manage the effective dependency version in your own project.

Transitively it comes from here https://mvnrepository.com/artifact/io.camunda/zeebe-client-java/8.5.6

@jonathanlukas
Copy link
Collaborator

@namero999 this is the official zeebe client, located here: https://github.com/camunda/camunda/tree/main/clients/java

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