Skip to content
Shihao Qi
ProjectsWritingNotesSearchAbout

TAG

Concurrency

Everything filed under this tag.

1 entries

01Notes

json.dump iterates while it writes: save outside the lock and you get “dictionary changed size during iteration”, save inside and every writer waits2026-10-16json.dump(data, f) doesn’t serialize first and then write; it uses the pure-Python encoder and writes while iterating, so serialization and disk I/O can’t be separated. Inside a lock, writers wait as long as the disk takes; outside, any concurrent change to the dict raises RuntimeError. Autarkia’s memory save went back and forth between the two.#Python#Concurrency
← All tagsSearch the site
© 2026 Shihao Qi
TagsRSSGitHubEmail