Skip to content

x/pkgsite/internal/poller: risk of starvation if the Getter starts taking too long #62200

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

Closed
bcmills opened this issue Aug 21, 2023 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@bcmills
Copy link
Contributor

bcmills commented Aug 21, 2023

While looking into #61269, I noticed what looks like a dangerous pattern in the poller implementation.

The poller uses context.WithTimeout to add a timeout for the configured Getter. Unfortunately, it sets that timeout to be exactly equal to the configured period: if the Getter runs within that period everything is fine, but if it starts taking marginally longer than the period, it is likely that every call will fail with a deadline exceeded error and whatever the poller is supposed to be doing will fail to make progress:
https://cs.opensource.google/go/x/pkgsite/+/master:internal/poller/poller.go;l=49;drc=694b5d3c2a971c2a1dcdf7ab34e521b762bd326d

Instead, I would generally expect the Getter to be invoked with the same Context that controls the lifetime of the poller overall, so that it will only fail if the Poller is being shut down.

(However, it might make sense to also invoke the onError callback as soon as the call overruns the period, so that it can trigger any monitoring that hooks into that callback.)

@gopherbot gopherbot added this to the Unreleased milestone Aug 21, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521656 mentions this issue: internal/poller: fix starvation if Poll takes longer than period

@hyangah hyangah modified the milestones: Unreleased, website/backlog Aug 31, 2023
@findleyr findleyr removed their assignment Aug 6, 2024
@prattmic
Copy link
Member

@findleyr https://go.dev/cl/521656 was abandoned. Should this issue be closed?

@prattmic prattmic added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 15, 2025
@findleyr
Copy link
Member

Thanks, yes not likely to be addressed any time soon. Let's just close.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

5 participants