The Wire · Showcase
PARALLEL TEST WORKERS NOW REUSE DATABASE CLONES, KILLING FLAKY TEST RUNS
By RepoJournal · Filed · About Django
Django fixed a critical race condition where respawned test workers would crash trying to connect to non-existent database clones, causing entire parallel test suites to abort.
ParallelTestSuite assigned worker IDs from a monotonically increasing counter, so when multiprocessing.Pool respawned a crashed worker, the replacement incremented past N and tried to connect to a database clone that never existed, fataling the entire run [1]. The fix reuses the database clones from exited workers instead of creating new ones, a pattern developers using parallel testing have been fighting since issue #27734 was opened. This lands alongside cleanup work removing outdated advice to include ticket numbers directly in test code [2]. GeoDjango also landed millisecond precision for GPX timestamp parsing [3] and fixed spatial index alteration on RasterField [4], while core fixes a subtle bug where DatabaseDefault was unexpectedly falling back to Python defaults on multi-table inheritance primary keys [5]. Translation updates rolled across django-localflavor [6].
One email a day. Unsubscribe in one click.
Keep up with Django in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Upgrade to latest Django if you run parallel tests - this eliminates worker respawn crashes django/django [immediate]
- → Review your test suite comments for removed ticket number guidance django/django [plan]
- → If using GeoDjango with GPX imports or RasterField spatial indexes, test after upgrading django/django [plan]
References
- [1] Fixed #27734 -- Made parallel test workers reuse database clones of exited workers. ↗ django/django
- [2] Removed advice to include ticket numbers in tests. django/django
- [3] Fixed #36626 -- geodjango -- Preserved milliseconds when parsing GPX … ↗ django/django
- [4] Fixed #37236 -- Allowed altering spatial indexes on RasterField. ↗ django/django
- [5] Fixed #37238 -- Fixed unintentional fallback to python default for a db_default. ↗ django/django
- [6] Updated translations from Transifex ↗ django/django-localflavor