Page MenuHomePhabricator

Improve the Kafka job queue's handling of unknown new jobs
Open, MediumPublic

Description

Per T240518#5751630, newly defined jobs are processed as part of a catchall low_traffic_jobs group unless a separate queue is specifically defined for them via ChangeProp rule. This creates a risk of a misbehaving job blocking a large number of miscellaneous jobs, as seen recently with the misbehaving fetchGoogleCloudVisionAnnotation job.

Some possible ideas of how to improve the situation:

  • Do not add jobs with release timestamps to the catchall group (throw an exception instead)
  • Require explicitly registering jobs via ChangeProp rule, with review to ensure they are placed in the correct group
  • Do not assume unknown new jobs will be low-traffic

Event Timeline

Note that while renqueue_delay defaults to 5 in the change-propagation repo, we set it much higher for the job types known to use a certain delay. This is done in order to avoid the "renqueue+ack" logic to avoid flooding kafka with re-enqueued messages:

aaron@aaron-Aspire-S5-371T:~/PhpstormProjects/deployment-charts$ colorgrep -r -C5 reenqueue_delay .
./helmfile.d/services/changeprop-jobqueue/values.yaml-      fetchGoogleCloudVisionAnnotations:
./helmfile.d/services/changeprop-jobqueue/values.yaml-        enabled: true
./helmfile.d/services/changeprop-jobqueue/values.yaml-        concurrency: 10
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # All the jobs of this kind are delayed exactly 48 hours, so we don't want
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # the reenqueue feature to kick in.
./helmfile.d/services/changeprop-jobqueue/values.yaml:        reenqueue_delay: 259200
./helmfile.d/services/changeprop-jobqueue/values.yaml-      notificationGetStartedJob:
./helmfile.d/services/changeprop-jobqueue/values.yaml-        enabled: true
./helmfile.d/services/changeprop-jobqueue/values.yaml-        concurrency: 10
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # All the jobs of this kind are delayed exactly 48 hours, avoid reenqueueing them
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # by setting the reenqueue delay to 72 hours
./helmfile.d/services/changeprop-jobqueue/values.yaml:        reenqueue_delay: 259200
./helmfile.d/services/changeprop-jobqueue/values.yaml-      notificationKeepGoingJob:
./helmfile.d/services/changeprop-jobqueue/values.yaml-        enabled: true
./helmfile.d/services/changeprop-jobqueue/values.yaml-        concurrency: 10
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # All the jobs of this kind are delayed exactly 48 hours, avoid reenqueueing them
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # by setting the reenqueue delay to 72 hours
./helmfile.d/services/changeprop-jobqueue/values.yaml:        reenqueue_delay: 259200
./helmfile.d/services/changeprop-jobqueue/values.yaml-      notificationReEngageJob:
./helmfile.d/services/changeprop-jobqueue/values.yaml-        enabled: true
./helmfile.d/services/changeprop-jobqueue/values.yaml-        concurrency: 10
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # All the jobs of this kind are delayed exactly 48 hours, avoid reenqueueing them
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # by setting the reenqueue delay to 72 hours
./helmfile.d/services/changeprop-jobqueue/values.yaml:        reenqueue_delay: 259200
./helmfile.d/services/changeprop-jobqueue/values.yaml-      newcomerTasksCacheRefreshJob:
./helmfile.d/services/changeprop-jobqueue/values.yaml-        enabled: true
./helmfile.d/services/changeprop-jobqueue/values.yaml-        concurrency: 10
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # All the jobs of this kind are delayed exactly 144 hours (6 days), avoid reenqueueing them
./helmfile.d/services/changeprop-jobqueue/values.yaml-        # by setting the reenqueue delay to 7 days
./helmfile.d/services/changeprop-jobqueue/values.yaml:        reenqueue_delay: 604800

A quick and dirty way to do this would be for JobQueueEvent bus config to take a "delayableTypes" parameter, that we'd configure to only have entries that have deployed changeprop-jobqueue/values.yaml config with reenqueue_delay. Other types would error out upon attempted insertion.