Sentry recently experienced two minor outages related to database lock-contention, where a process waits for another shared resource it depends on, causing brief moments of unavailability. The issue was caused by a long-running query that affected the production database and billing system, leaving pending changes in an incomplete state. To identify the root cause, Sentry used its robust tagging and search infrastructure to find the original exception, which led to a dedicated database connection being used instead of the default one, causing excessive lock contention. The fix was to use the correct database connection, adding test coverage to prevent similar mistakes in the future and highlighting the importance of tracing critical context with tools like Breadcrumbs.