You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The on-disk model cache is not written atomically. FileCache.put opens the cache file with "wb", which truncates it, then pickle/gzip writes the contents.
With xdist, two workers can share the same cache file. A reader can open the file after truncate and before the write finishes. pickle.load then fails with “Ran out of input”. In this run, silver.d never made it into the LSP map.
This is a cache race, not a bad assertion in the LSP test.
Possible Fix
In sqlmesh/utils/cache.pyFileCache.put, stop writing the cache file in place ("wb" truncates it first).
Write the gzip/pickle to a temp file in the same directory.
os.replace that temp file onto the real cache path.
That way another pytest-xdist worker never reads a half-written models__d entry.
Optionally retry FileCache.get once if pickle hits EOF / “Ran out of input”, then load from SQL.
Don’t xfail the LSP test. The test is fine; the cache write is the bug.
Activity
7487 commentedon Sep 4, 2026
I'm working on this — fix is up in #6011. Happy to be assigned.