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

Fix errors in integration tests on shutdown of client #47

Open
dsyer opened this issue Nov 6, 2024 · 3 comments
Open

Fix errors in integration tests on shutdown of client #47

dsyer opened this issue Nov 6, 2024 · 3 comments

Comments

@dsyer
Copy link
Collaborator

dsyer commented Nov 6, 2024

I see some stack traces in tests sometimes because a context is closed before the client is shutdown. Not sure why, and it's mostly harmless, but it would be good to not see it.

@dsyer dsyer changed the title graceful shutdown client Graceful shutdown of client Nov 9, 2024
@CyberZujo
Copy link
Contributor

@dsyer Can I take this one?

@dsyer
Copy link
Collaborator Author

dsyer commented Nov 9, 2024

Sure. I don’t really know how to start. As far as I know we already shut the clients down. It might just be a test that needs fixing?

@dsyer dsyer closed this as completed Nov 10, 2024
@dsyer dsyer reopened this Nov 10, 2024
@dsyer dsyer changed the title Graceful shutdown of client Fix errors in integration tests on shutdown of client Nov 10, 2024
@dsyer
Copy link
Collaborator Author

dsyer commented Jan 22, 2025

Example:

2025-01-22T12:03:02.073Z  INFO 2101293 --- [grpc-server] [ault-executor-0] o.s.grpc.sample.GrpcServerService        : Hello foo
2025-01-22T12:03:02.075Z ERROR 2101293 --- [grpc-server] [ault-executor-0] io.grpc.internal.SerializingExecutor     : Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@25f6f7aa

java.lang.IllegalStateException: call already closed	at com.google.common.base.Preconditions.checkState(Preconditions.java:513) ~[guava-33.3.1-jre.jar:na]
Preconditions.java:513
	at io.grpc.internal.ServerCallImpl.closeInternal(ServerCallImpl.java:218) ~[grpc-core-1.69.0.jar:1.69.0]
ServerCallImpl.java:218
	at io.grpc.internal.ServerCallImpl.close(ServerCallImpl.java:213) ~[grpc-core-1.69.0.jar:1.69.0]
ServerCallImpl.java:213
	at org.springframework.grpc.server.exception.GrpcExceptionHandlerInterceptor$ExceptionHandlerListener.onHalfClose(GrpcExceptionHandlerInterceptor.java:108) ~[classes/:na]
GrpcExceptionHandlerInterceptor.java:108
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:356) ~[grpc-core-1.69.0.jar:1.69.0]
ServerCallImpl.java:356
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:861) ~[grpc-core-1.69.0.jar:1.69.0]
ServerImpl.java:861
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.69.0.jar:1.69.0]
ContextRunnable.java:37
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.69.0.jar:1.69.0]
SerializingExecutor.java:133
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
ThreadPoolExecutor.java:1136
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
ThreadPoolExecutor.java:635
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Thread.java:833

2025-01-22T12:03:02.155Z  INFO 2101293 --- [grpc-server] [ionShutdownHook] o.s.g.s.lifecycle.GrpcServerLifecycle    : Completed gRPC server shutdown

Another (possibly), this time not an integration test:

[INFO] Running org.springframework.grpc.client.GrpcChannelFactoryTests$SpecificGrpcChannelFactoryTests
Jan 22, 2025 12:18:19 PM io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference cleanQueue
SEVERE: *~*~*~ Previous channel ManagedChannelImpl{logId=1, target=localhost} was garbage collected without being shut down! ~*~*~*
    Make sure to call shutdown()/shutdownNow()
java.lang.RuntimeException: ManagedChannel allocation site
        at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.<init>(ManagedChannelOrphanWrapper.java:102)
        at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:60)
        at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:51)
        at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:710)
        at io.grpc.ForwardingChannelBuilder2.build(ForwardingChannelBuilder2.java:272)
        at org.springframework.grpc.client.DefaultGrpcChannelFactory.createChannel(DefaultGrpcChannelFactory.java:94)
        at org.springframework.grpc.client.GrpcChannelFactoryTests$SpecificGrpcChannelFactoryTests.shadedNettyChannelFactoryUsesShadedNettyChannelBuilder(GrpcChannelFactoryTests.java:144)

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

2 participants