#36997: test_double_replaced_migrations_are_checked_correctly fails 
intermittently
under Windows Subsystem for Linux (WSL)
----------------------------------+--------------------------------------
     Reporter:  Stewart Matheson  |                    Owner:  (none)
         Type:  Bug               |                   Status:  closed
    Component:  Migrations        |                  Version:  dev
     Severity:  Normal            |               Resolution:  needsinfo
     Keywords:                    |             Triage Stage:  Unreviewed
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------
Comment (by Stewart Matheson):

 The issue relates is a file system a race condition that is most likely
 being triggered by the unpredictable timings of the filesystem running
 under HyperV and WSL. After the test writes the first migration file to
 the /tmp folder there is a chance that the filesystem mtime update is
 still waiting in the FS journal. When the migration system performs a
 second read its reading the filesystem before the mtime has been updated
 from the previous write. Because of this timing python's file cache is not
 invalidated when the test expects it to be. The result is that the first
 migration will be over written and the test will fail when it attempts to
 squash migrations that don't exist because they where never written in the
 first place.

 Running the same test on bare metal linux, docker linux or macos is
 unlikely to trigger this issue is their filesystems have timings that are
 more predictable than WSL.

 Running
 {{{
  importlib.invalidate_caches()
 }}}

 Each time after a migration file is written resolves this issue for me as
 python will bypass reading the mtime. Given all that I'm not too sure how
 you would reproduce this as I would have thought other WSL users would be
 running in to this issue.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36997#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d1cd7b622-33934119-df0e-4753-aa2f-4e1c3f14b30d-000000%40eu-central-1.amazonses.com.

Reply via email to