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

PubSub: Occasional / Intermittent java.net.UnknownHostException: pubsub.googleapis.com #2061

Open
salvatorenovelli opened this issue Jun 5, 2024 · 0 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/java-pubsub API.

Comments

@salvatorenovelli
Copy link

I have a spring boot application running on (docker compose) GCP VM occasionally logging the exception below.
This behaviour is also visible in my integration testing with a fail rate of around 0.9%.

The odd thing is that in this integration test I have multiple applications (containers run as testcontainers) connecting to pubsub and while one fails, the other seem to be able to subscribe, receive and publish messages.

But in the application where the exception is thrown, pubsub commands will hang and eventually timeout. eg: com.google.cloud.spring.pubsub.PubSubAdmin#getTopic

Environment details

This is a spring boot '3.2.5' application, running 'com.google.cloud:spring-cloud-gcp-starter-pubsub:5.4.1'.
Java 17 on eclipse-temurin:17-jre-alpine

Steps to reproduce

During my integration testing, this error will manifest randomly just by launching the applicaion and attempting to subscribe to a topic. I can consistently reproduce this over (100 or so runs) by running the test continuosly (until failure).

The problem is that this is also consistently happening in production, over the past years. The exception is logged while the application is running. This follows the same dynamics: other applications seem to work fine but one will seemingly randomly throw this exception and stop working.

Stack trace

2024-06-05T08:19:30.235Z  WARN 1 --- [customer-repository] [ault-executor-2] io.grpc.internal.ManagedChannelImpl      : [Channel<5>: (pubsub.googleapis.com:443)] Failed to resolve name. status=Status{code=UNAVAILABLE, description=Unable to resolve host pubsub.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: pubsub.googleapis.com
	at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223)
	at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282)
	at io.grpc.grpclb.GrpclbNameResolver.doResolve(GrpclbNameResolver.java:63)
	at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: pubsub.googleapis.com
	at java.base/java.net.InetAddress$CachedAddresses.get(Unknown Source)
	at java.base/java.net.InetAddress.getAllByName0(Unknown Source)
	at java.base/java.net.InetAddress.getAllByName(Unknown Source)
	at java.base/java.net.InetAddress.getAllByName(Unknown Source)
	at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:632)
	at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219)
	... 6 more
}

Thanks for your support!
happy to share more details as required

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/java-pubsub API. label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/java-pubsub API.
Projects
None yet
Development

No branches or pull requests

2 participants