mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 06:09:33 +08:00
On Windows, file_lock_shared took msvcrt LK_NBLCK, which is an exclusive, mandatory byte-range lock (msvcrt has no shared lock). A reader that overlapped another reader failed with PermissionError, _read_and_reconcile_config mapped that to an empty catalog, and the next update_kb_status auto-registered its KB into the empty catalog and saved it, dropping every other knowledge base's entry from kb_config.json. Writers already replace the file atomically, so readers need no lock: take none on Windows. POSIX keeps its LOCK_SH.