Skip to content

fix: prevent permanent hang and singleton deadlock#2

Open
VimWei wants to merge 1 commit into
brglng:mainfrom
VimWei:fix/hang-and-singleton-deadlock
Open

fix: prevent permanent hang and singleton deadlock#2
VimWei wants to merge 1 commit into
brglng:mainfrom
VimWei:fix/hang-and-singleton-deadlock

Conversation

@VimWei

@VimWei VimWei commented Jun 22, 2026

Copy link
Copy Markdown

Replace CreateFileMapping singleton guard with named mutex, use per-process unique event names, and add timeout to event wait.

  1. Mutex (Local\IMControlMutex) replaces file mapping as singleton guard — auto-released when process dies, no residual blocking.
  2. Unique event name per process (IMControlDoneEvent_) stored in SharedData — prevents stale hook DLLs from interfering.
  3. WaitForSingleObject timeout: INFINITE → 10000ms; on timeout returns ERR_SEND_MESSAGE_TIMEOUT_TIMED_OUT instead of hanging.
  4. Hook DLL reads event name from shared memory.
  5. Bump version to 0.5.1.

@VimWei VimWei force-pushed the fix/hang-and-singleton-deadlock branch 2 times, most recently from d1fed41 to 9d8957b Compare June 22, 2026 06:17
Replace CreateFileMapping singleton guard with named mutex,
add timeout to event wait, and reset stale event state.

1. Mutex (Local\IMControlMutex) replaces file mapping as singleton
   guard — auto-released when process dies, no residual blocking.
2. WaitForSingleObject timeout: INFINITE → 10000ms; on timeout
   returns ERR_SEND_MESSAGE_TIMEOUT_TIMED_OUT instead of hanging.
3. ResetEvent after CreateEventA to clear leftover signaled state
   from residual hook DLLs in target processes.
4. Bump version to 0.5.1.
@VimWei VimWei force-pushed the fix/hang-and-singleton-deadlock branch from 9d8957b to 99cad69 Compare June 22, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant