Skip to content

getAttribute fetches data from http://metadata.google.internal/computeMetadata/v1/ without a timeout #421

@olavloite

Description

@olavloite

detectSupportedPlatform tries to fetch data from a URL. This can take a long time on hosts that do not have access to that host:

  1. detectSupportedPlatform calls isRunningOnGcp():
  2. isRunningOnGcp() calls GcpMetadataConfig#getProjectId()
  3. GcpMetadataConfig#getProjectId() calls getAttribute(String)
  4. getAttribute tries to fetch data from http://metadata.google.internal/computeMetadata/v1/

The latter can potentially block for a long time. Would it maybe be better to add a timeout to that call?

Background: googleapis/java-spanner-jdbc#2250

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions