PackageMetadataMalwareAdvisorySyncStalled
This playbook covers both alerts on the v3 package metadata sync:
| Alert | Fires when |
|---|---|
PackageMetadataMalwareAdvisorySyncStalled | No malware advisory registry has synced successfully in the last hour (12 runs) |
SidekiqServicePackageMetadataV3SyncErrorSLOViolation | Too many registry syncs fail, for any data type (malware advisories, licenses, advisories) |
Overview
Section titled “Overview”GitLab.com syncs malware advisories from the PMDB Distribution Service (PDS) into the pm_malware_advisories and pm_malware_affected_packages tables on the sec database. Dependency scanning and the dependency firewall read them to flag malicious packages.
PackageMetadata::MalwareAdvisoriesSyncWorkerruns every 5 minutes, under an exclusive lease of 22 minutes.- Each run syncs every registry PDS serves (npm, pypi, gem, golang, maven, nuget, cargo), mostly with a single bulk
/deltarequest. A registry with no checkpoint yet downloads the full/allsnapshot first. - Each registry advances its own checkpoint in
pm_checkpoints(on themaindatabase), so a failed run resumes where it stopped.
When an alert fires, new malicious packages stop reaching GitLab.com. Customers keep the advisories already synced; nothing is lost, and the next successful run catches up.
What to do: find whether the worker is running at all, then why the syncs fail (see Troubleshooting).
Services
Section titled “Services”- Sidekiq service overview
- Owner: group::security foundations (Composition Analysis), Slack
#g_ast-composition-analysis
Metrics
Section titled “Metrics”Both alerts use the package_metadata_v3_sync application SLI, defined in metrics-catalog/gitlab-slis/library.libsonnet and attached to the sidekiq service in metrics-catalog/services/sidekiq.jsonnet. It is emitted by PackageMetadata::V3SyncService in GitLab Rails.
gitlab_sli_package_metadata_v3_sync_total{data_type}: one per registry per run, except a run with no instance token, which records a single error.gitlab_sli_package_metadata_v3_sync_error_total{data_type}: the registries whose sync failed.
What counts:
- Success: the registry ingested new data, was already up to date, or was stopped by the run’s time budget after advancing its checkpoint with every batch persisted (it resumes on the next run).
- Error: PDS rejected or failed the request (a
400, a5xxor a network error), the run had no instance token, the archive could not be read, or the records did not persist. - Not measured: registries PDS does not serve, and registries the run’s time budget stopped before their checkpoint moved or after a batch failed to persist (the next run reports that failure).
Thresholds:
PackageMetadataMalwareAdvisorySyncStalledcounts successes (total minus errors) fordata_type="malware_advisories"over 1 hour. Fewer than 0.5 for 10 minutes fires. This catches a sync that stopped running, which the error ratio cannot see because both counters stop. It evaluates in gprd only.- The error SLO is 1% (
errorRatio: 0.99) with the standard multi-window burn-rate alerts, and the sample gate is lowered to 50 per window. A single failed bulk/deltarequest fails every registry in that run, so two failed runs within an hour is enough to burn the 1-hour window.
Under normal conditions, malware advisories record about 7 measurements per run (about 80 an hour) with an error ratio near 0. Most runs are delta_up_to_date: PDS has no new data for most registries most of the time. Over 30 days in November 2026, the longest stretch with no new advisories written was 13 hours, so “no new data” alone is normal; “no successful sync” is not.
Alert Behavior
Section titled “Alert Behavior”- Expected to be rare. Both alerts are
s3: they go to#g_ast-composition-analysis-alertsand do not page. - The SLO alert is also generated for
gstgandpre, like every Sidekiq SLI, so a staging PDS outage can fire it there. Onlygprdalerts reach the team channel; non-production ones go to the shared non-production channel. - Silence
PackageMetadataMalwareAdvisorySyncStalledduring a planned PDS outage, for its duration only. - After a deploy that restarts Sidekiq, the counters restart at 0;
increase()handles the reset.
Severities
Section titled “Severities”- Customer impact is delayed detection of new malicious packages for every GitLab.com customer using dependency scanning or the dependency firewall. Packages already flagged stay flagged.
- Raise the severity if the sync has been stalled for more than a day, or if a widely reported malicious package is missing from GitLab.com.
Verification
Section titled “Verification”-
Successes in the last hour (the stalled alert’s expression):
sum by (env) (increase(gitlab_sli_package_metadata_v3_sync_total{env="gprd", data_type="malware_advisories"}[1h]))-sum by (env) (increase(gitlab_sli_package_metadata_v3_sync_error_total{env="gprd", data_type="malware_advisories"}[1h])) -
Is the worker running? Job completions in the last hour:
sum(increase(sidekiq_jobs_completion_count{env="gprd", worker="PackageMetadata::MalwareAdvisoriesSyncWorker"}[1h])) -
Kibana: the malware advisory sync dashboard, https://log.gprd.gitlab.net/app/r/s/whjHw, built on
json.event: "malware_advisory_sync"in the Sidekiq index.
Recent changes
Section titled “Recent changes”- GitLab Rails merge requests touching the v3 sync
- PDS (
pmdb-dist-svc) changes: check its Runway deployments and thePmdbDistSvcGke*alerts.
Troubleshooting
Section titled “Troubleshooting”- Is the worker running? Check job completions (query above), or in Kibana filter
json.class: "PackageMetadata::MalwareAdvisoriesSyncWorker". About 288 runs a day is normal.- No jobs: check the Sidekiq cron (
package_metadata_malware_advisories_sync_workerinee/config/schedule.yml). - Jobs finish in under a second: another run holds the exclusive lease, logged as
json.message: "Cannot obtain an exclusive lease. There must be another instance already in execution."withjson.class_name: "PackageMetadata::MalwareAdvisoriesSyncWorker". A lease left behind by a killed job expires after 22 minutes.
- No jobs: check the Sidekiq cron (
- Why do registries fail? In Kibana, filter
json.event: "malware_advisory_sync"andjson.severity: "ERROR", then group byjson.phase:aborted_no_token: the instance token (IJWT) is missing. Check Cloud Connector.bulk_delta_failedorfetch_rejected: PDS failed or rejected the request. Check the PDS alerts (PmdbDistSvcGke*) and its service overview.purl_type_mismatch: an archive held another registry’s records, so that registry’s checkpoint did not advance.- No
ERRORline: the sync raised, for example on an unreadable archive or a failed upsert. Filterjson.class: "PackageMetadata::MalwareAdvisoriesSyncWorker"andjson.job_status: "fail", readjson.exception.class, and check Sentry.
- Which registries? Group the
completedlines byjson.purl_typeto find a single registry that keeps failing.
Possible Resolutions
Section titled “Possible Resolutions”- PDS outage: wait for PDS to recover; the next run catches up from each checkpoint.
- Stuck lease: wait for it to expire (22 minutes).
Dependencies
Section titled “Dependencies”- PMDB Distribution Service (
pmdb-dist-svc) on Runway. - Cloud Connector, for the instance token sent to PDS.
- The
secdatabase (advisories) and themaindatabase (pm_checkpoints).
Escalation
Section titled “Escalation”#g_ast-composition-analysisfor the sync, the data and PDS.
Definitions
Section titled “Definitions”- Stalled alert:
libsonnet/alerts/package-metadata-v3-sync-alerts.libsonnet, tested intest/mimir-rules/package-metadata-v3-sync-alerts_test.yml. - Error SLO: the
package_metadata_v3_syncentry inmetrics-catalog/services/sidekiq.jsonnet. - Don’t shorten the stalled window below 1 hour: a single slow
/allsnapshot can hold the lease for up to 22 minutes. - Update the template used to format this playbook