Skip to content

Incorrect log message for usage with domain names #936

@jackwotherspoon

Description

@jackwotherspoon

There is buggy logic around a Dial log message:

// Log if resolver changed the instance name input string.
if cn.String() != icn {
d.logger.Debugf(ctx, "resolved instance %s to %s", icn, cn)

When Dial is called with a DNS domain name as the icn this logic message code path will always be executed (even if the domain name still points at the same instance) even when it shouldn't be.

The reason being that cn.String() has additional formatting done to it:

func (c *ConnName) String() string {
if c.domainName != "" {
return fmt.Sprintf("%s -> %s:%s:%s", c.domainName, c.project, c.region, c.name)
}

Example: If a user calls Dial with the domain name example.com as the icn.
Then cn.String() would always return example.com -> my-project:region:instance
and continuously log a debug message.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions