An Empty GitLab Group Path Put 2,000 Installs on One Sentry Record

Sentry's Control RPC deployment sat at its 256-pod ceiling because a four-year-old GitLab grouping bug let one Integration record collect more than 2,000 installations. A webhook fix and an N² lookup did the rest.

Share
Abstract diagram of hundreds of small points all linked to one central record, with a few small separate records off to the left.

Gabriel Villalobos at Sentry published a write-up on November 25 about a Control RPC deployment that normally sits near its floor of about 32 pods. One day it held at its ceiling of 256 for hours. External traffic was up about 2x and the pod count was up about 8x. Finding out why took weeks. The cause was three bugs in Sentry's GitLab integration that together could turn one incoming webhook into millions of internal RPC calls.

Most of the post covers the autoscaler and the N² loop, and both deserve the space. The part I keep coming back to is smaller: the lookup key that let one database record collect more than 2,000 installations without anyone noticing.

How one record got 2,000 installations

Sentry keeps a shared Integration record for each external resource, and each Sentry organization that connects to it gets its own OrganizationIntegration record pointing at it. The install logic is re-entrant. It finds an existing Integration by an external ID and reuses it. For GitLab, that ID is the group ID plus the hostname, because customers can also connect self-hosted GitLab instances.

About four years ago, Sentry let GitLab users include all of their groups by leaving the group path empty. According to the write-up, this "also grouped unrelated installations together when the hostname was https://gitlab.com." Every group-less install on hosted GitLab attached to the same record. Over four years it collected more than 2,000 installations.

For most of that time it caused no visible trouble.

What made it expensive

Two later changes did. Earlier this year Sentry added GitLab issue assignment syncing, plus a backfill to set up webhook triggers for existing installations. The backfill was broken at launch. In mid-September a fix landed that made sure webhook triggers were configured for every project under the parent integration. The fix did what it was meant to do, and on the shared record that meant webhooks across all 2,000-plus installations.

The assignment sync path had what the post calls "a degenerate case." For every installation, it looked up installations by their parent integration. Webhooks are handled in Region silos and integration data lives in Control, so each lookup was an RPC call across the silo boundary. With N above 2,000, one pass is about 2,000 calls, and there is a pass for each installation in the result. 2,000 squared is 4 million, which fits the write-up's "millions of RPC calls" for a single webhook.

The post sums it up well: "The grouping bug sat quietly for four years. The N² lookup is harmless when N is 1." I would add that N was only large because of the key.

Why the dashboards pointed somewhere else

Horizontal bar chart of Sentry Control RPC pod counts: normal floor about 32, weekly average after the fix about 42, weekly average before the fix about 150, ceiling 256.
Control RPC pod counts as stated in Sentry's write-up by Gabriel Villalobos (blog.sentry.io, Nov 25 2026).

Two things hid the cause. Total RPC call counts looked roughly flat week over week. Only after a new latency monitor started firing, and the team broke calls down by method, did integrations.get_organization_integrations show up. It had gone up about 10x within a week.

The autoscaler also had a signal that more pods could not lower. KEDA scaled the deployment on five metrics, each counted equally, and one was the P95 busyness of the Granian HTTP servers. A few slow, IO-heavy requests kept that tail high however many pods were added, while average CPU per pod stayed low. Villalobos raised the busyness target by 15% and the pods kept scaling. He later moved to P75 with a slightly lower target and a higher per-pod requests-per-second limit. That helped, but the deployment still sat near the top during the weekly peak from Tuesday evening to Thursday afternoon.

A teammate on the source code management team shipped a patch to the sync path. Before it, the deployment averaged about 150 pods over the week. After it, the average was about 42, roughly 108 fewer pods or about 72% less.

The write-up is honest that this is not closed. Rolling back the P75 change sent the deployment straight back into a scale-up spiral, and Sentry does not yet know why a subset of pods keeps running hot.

The check I would add

Sentry's own checklist is good. Confirm your scaling metrics drop when you add pods, break internal RPC volume down by method, look for N+1 and N² calls that cross a network boundary, and ask what the largest N in production actually is. I would put one more item ahead of those, because it targets the cause.

For every dedupe or reuse key in install or upsert logic, test what happens when one part of the key is empty. A key built from a group ID and a hostname is unique only while the group part is there. Without it, the hostname decides alone, and on a hosted service every customer has the same hostname. That is how unrelated installations end up sharing a record. Finding it in production takes one query: group child records by parent and sort by count. A parent with 2,000 children where you expected one or a handful is the bug, and you can see it before any loop runs over it.

Sentry deserves credit for publishing a slow, messy investigation with the dead ends and the open question left in. The full post also has the lemonade-stand analogy a teammate got from Claude for why P95 scaling never settles.

0 subscribers
0 average monthly readers