Skip to content

DB Backend: report explicit error when transactions are used concurrently

Warren Gifford requested to merge cc/safe-transactions into main

Created by: camdencheek

This updates our transaction wrapper to return an explicit error whenever a transaction is used concurrently. Concurrent transaction access is a form of race condition that causes (in my experiments) either a conn busy error, a bad connection error, or a panic. So, instead of getting these errors that are very difficult to debug, this PR throws an error logs aan error with the stack trace that actually describes what's wrong. These errors should get pushed to Sentry, which will allow us to track where this is happening

Stacked on https://github.com/sourcegraph/sourcegraph/pull/37167

Test plan

Added DB tests that exercise the error return.

Merge request reports

Loading