openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Stale auth-profiles.lock blocks all RPC calls — user stuck in error loop

Open graycyrus opened this issue 6 months ago • 1 comments

Summary

A stale auth-profiles.lock file prevents the auth profile from being read, causing every RPC call (including app_state_snapshot) to fail. The lock is never cleaned up, so the user gets stuck in a rapid-fire error loop — 16 errors in 30 seconds from a single user.

Sentry Issues

Error: Failed to create auth profile lock at <user_home>/.openhuman/users/<id>/auth-profiles.lock Environment: production Platforms: macOS (aarch64) + Windows (x86_64)

Analysis

  • All 16 macOS events are from the same user within a 30-second window (06:37:03 → 06:37:33), fired every ~2 seconds by app_state_snapshot polling
  • The lock file from a previous crash or concurrent process is never cleaned up
  • Every subsequent RPC call fails because it can't acquire the lock
  • The app is effectively completely broken for this user until they manually delete the lock file

Suggested Fix

  1. Stale lock detection — check if the process that created the lock is still alive; if not, remove the stale lock
  2. Lock timeout — auto-expire locks older than N seconds
  3. Graceful degradation — if the lock can't be acquired for app_state_snapshot, return cached/stale data instead of erroring
  4. Crash cleanup — on startup, clean up any lock files left by a previous instance

Priority: High — completely blocks one user, cross-platform

graycyrus avatar May 13 '26 09:05 graycyrus

Picking this up. Plan: write PID into the lock on acquire, then on subsequent acquires check whether that PID is still alive — if not, remove the stale file and retry. Also clean up any leftover lock on startup so a previous crash does not block the next run. Will keep the change scoped to the lock acquisition path and add Rust unit tests for the dead-PID / alive-PID / missing / malformed cases.

obchain avatar May 13 '26 12:05 obchain