Skip to content

PubSub Topics Retrieval Blocks Indefinitely When Not Authenticated #5465

@gtomassi

Description

@gtomassi

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");

    }

Metadata

Metadata

Assignees

Labels

triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions