Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warmup and EngineVersion don't close cache on failed lookup #778

Open
enocom opened this issue Apr 23, 2024 · 0 comments
Open

Warmup and EngineVersion don't close cache on failed lookup #778

enocom opened this issue Apr 23, 2024 · 0 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@enocom
Copy link
Member

enocom commented Apr 23, 2024

EngineVersion doesn't close the cache on error:

cn, err := instance.ParseConnName(icn)
if err != nil {
return "", err
}
i := d.connectionInfoCache(cn, nil)
ci, err := i.ConnectionInfo(ctx)
if err != nil {
return "", err
}
return ci.DBVersion, nil

Warmup doesn't close the cache on error:

cn, err := instance.ParseConnName(icn)
if err != nil {
return err
}
cfg := d.defaultDialConfig
for _, opt := range opts {
opt(&cfg)
}
_ = d.connectionInfoCache(cn, &cfg.useIAMAuthN)
return nil

As a result, if a client connects with a bad instance connection name, missing IAM permissions, no network connectivity etc, the background refresh will continue running regardless.

Instead, we should close the cache and delete it from the shared map.

@enocom enocom added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants