[
https://issues.apache.org/jira/browse/CAMEL-23571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082431#comment-18082431
]
Dave Riseley commented on CAMEL-23571:
--------------------------------------
Thanks for merging the fix [~davsclaus], is there any chance this could be
backported to 4.18.x as well? We are in the process of upgrading from 4.14.x
to 4.18.x and this broke our integration tests
> Google PubSub component leaves orphaned channels when using PubSub emulator
> ---------------------------------------------------------------------------
>
> Key: CAMEL-23571
> URL: https://issues.apache.org/jira/browse/CAMEL-23571
> Project: Camel
> Issue Type: Bug
> Components: camel-google-pubsub
> Affects Versions: 4.18.2, 4.20.0
> Reporter: Dave Riseley
> Priority: Minor
> Labels: pull-request-available, test-stability
> Fix For: 4.21.0
>
>
> When using the Google PubSub emulator, orphaned channels are left open by the
> GooglePubsubComponent that are cleaned up via garbage collection. When this
> happens, a stack trace similar to the following is seen in the logs:
> {code}
> 2026-05-20 14:46:01,246 [t-max-delivery]] ERROR ManagedChannelOrphanWrapper
> - *~*~*~ Previous channel ManagedChannelImpl{logId=2,
> target=localhost:32920} 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:110)
> 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:737)
> at
> io.grpc.ForwardingChannelBuilder2.build(ForwardingChannelBuilder2.java:278)
> at
> org.apache.camel.component.google.pubsub.GooglePubsubComponent.getSubscriptionAdminClient(GooglePubsubComponent.java:222)
> at
> org.apache.camel.component.google.pubsub.GooglePubsubConsumer.resolveMaxDeliveryAttempts(GooglePubsubConsumer.java:146)
> at
> org.apache.camel.component.google.pubsub.GooglePubsubConsumer.doStart(GooglePubsubConsumer.java:93)
> at
> org.apache.camel.support.service.BaseService.start(BaseService.java:132)
> at
> org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:129)
> ...
> {code}
> This entries are visible in the camel-google-pubsub-test.log produced by the
> unit and integration tests, which use the PubSub emulator.
> This issue appears to have been introduced by CAMEL-23142 ([~acosentino] FYI)
> The fix is to switch to use an InstantiatingGrpcChannelProvider which creates
> channels whose lifecycle is managed by the owning client.
> I will create a PR that updates the tests to fail if these orphaned channels
> are logged and corrects the implementation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)