Closed salvatorenovelli closed 3 weeks ago
Hello! An UnknownHostException
is not an error that would be caused by the client library, but rather would likely be related to the environment in which the application is running. One possibility is that DNS resolution is taking some time on application start-up, but to find the specific issue, I would recommend opening a support case.
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
Thanks for your support! happy to share more details as required