x/pkgsite/internal/poller: risk of starvation if the Getter
starts taking too long
#62200
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
pkgsite
Milestone
While looking into #61269, I noticed what looks like a dangerous pattern in the
poller
implementation.The
poller
usescontext.WithTimeout
to add a timeout for the configuredGetter
. Unfortunately, it sets that timeout to be exactly equal to the configured period: if theGetter
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 adeadline 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 sameContext
that controls the lifetime of the poller overall, so that it will only fail if thePoller
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.)The text was updated successfully, but these errors were encountered: