Fix race condition in concurrent extension media installation.

Review Request #14856 — Created Feb. 26, 2026 and updated — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

When running tests on CI, I hit a race condition which caused the
ExtensionManagerTests::test_install_media_concurrent_threads test to
fail.

The version check in install_extension_media() happened only before
acquiring the lock file. If one thread completed the install and released
the lock before another thread attempted to acquire it, the second thread
would successfully lock and redundantly reinstall, since its local
old_version was already stale.

This change makes us re-check the installed version after acquiring the
lock to skip the install if another thread/process already completed it.

Ran unit tests.

Commits

Files