openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Windows: 'Reset local data' fails when .openhuman directory is locked by another process

Open graycyrus opened this issue 6 months ago • 1 comments

Summary

On Windows, the config_reset_local_data RPC method fails when the .openhuman directory is locked by another process (os error 32 = ERROR_SHARING_VIOLATION).

Sentry Issues

Error: Failed to remove C:\Users\<username>\.openhuman: 另一个程序正在使用此文件,进程无法访问。 (os error 32) Environment: production Platform: Windows (x86_64)

Analysis

  • Triggered when users try to reset their local data
  • The core sidecar itself (or another OpenHuman instance) likely holds open file handles in .openhuman/
  • On Windows, files cannot be deleted while any process has them open
  • Two different users hit this independently

Suggested Fix

  1. Close own handles first — before deleting, close any open DB connections, file handles, etc. in the .openhuman directory
  2. Schedule deletion — mark for deletion on next restart if in-use
  3. User guidance — show "Close all OpenHuman windows and try again" if deletion fails due to file locks

Priority: Low — 2 events, edge case during reset flow

graycyrus avatar May 13 '26 09:05 graycyrus

Closing as resolved — all three suggested fixes shipped across three merged PRs, and the implementation is present on main:

  • #1811 (merged 2026-05-16) — detect Windows file-lock failures during reset; surface the real core error in Settings + Welcome recovery flows instead of generic UI copy; Windows-only test.
  • #2395 (merged 2026-05-22) — route reset-data delete failures through a shared formatter; detect ERROR_SHARING_VIOLATION and show "close other OpenHuman windows" guidance.
  • #2668 (merged 2026-05-28) — the root fix: drop the host-process rolling log file handle (<data_dir>/logs/openhuman-*.log) before remove_dir_all (the real reason the lock persisted even after the embedded core shut down), plus a Windows fallback that walks the tree and queues locked entries for deletion on next reboot.

Maps to the issue's suggested fixes 1 (close own handles), 2 (schedule deletion on restart), and 3 (user guidance). Verified on main: app/src-tauri/src/local_data_reset.rs, reset_reboot_schedule.rs, and local_data_reset_tests.rs.

(Note: PR #1285 also references this number but is unrelated — webview cold-open work — so the GitHub cross-link there is incidental.)

Reopen if the os error 32 Sentry signature (OPENHUMAN-TAURI-C6/C7) recurs on a build dated after 2026-05-28.

oxoxDev avatar Jun 02 '26 11:06 oxoxDev