com.google.cloud.pubsub.v1.TopicAdminClient.listTopics blocks forever when gcloud credentials are invalid.
Occurred on local machine and when running on GKE, using com.google.cloud:google-cloud-pubsub:1.77.0
Recommended fix:
Exception should be thrown, at a minimum internal operations underneath listTopics should timeout after some reasonable time. Additionally, faulty credentials should be invalidated and exception should be thrown stating authentication issues.
To reproduce:
public static void main(String[] args) throws Exception {
TopicAdminSettings topicAdminSettings = TopicAdminSettings.newBuilder().setCredentialsProvider(ComputeEngineCredentials::create).build();
TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
String projectName = ProjectName.of(ServiceOptions.getDefaultProjectId()).toString();
System.out.println("BEFORE LIST TOPICS");
topicAdminClient.listTopics(projectName); // Hangs forever
System.out.println("AFTER LIST TOPICS -- never reaches");
}
com.google.cloud.pubsub.v1.TopicAdminClient.listTopics blocks forever when gcloud credentials are invalid.
Occurred on local machine and when running on GKE, using com.google.cloud:google-cloud-pubsub:1.77.0
Recommended fix:
Exception should be thrown, at a minimum internal operations underneath listTopics should timeout after some reasonable time. Additionally, faulty credentials should be invalidated and exception should be thrown stating authentication issues.
To reproduce: