Skip to content

Don't interrupt the on-chip match when a verify is cancelled - #297

Open
nacos82 wants to merge 1 commit into
uunicorn:masterfrom
nacos82:pr/cancel-during-match
Open

nacos82 wants to merge 1 commit into
uunicorn:masterfrom
nacos82:pr/cancel-during-match

Conversation

@nacos82

@nacos82 nacos82 commented Nov 17, 2026

Copy link
Copy Markdown

Problem

Cancelling a verify while match_finger() waits for the match interrupt (a GDM or sudo fingerprint timeout, or typing the password instead) sends the cleanup command 0x62 mid-match. On 138a:0097 (ThinkPad T470s) the sensor then drops off the USB bus and re-enumerates. The service keeps the dead handle, the atexit reboot fails with [Errno 19] No such device, and the service exits.

Trace: wait_int() → CancelledException → finally: tls.app('6200000000') → USBError: [Errno 19].

Fix

wait_int() gets a non-cancellable mode with a max_wait limit, and match_finger() uses it, so the match always finishes before cleanup. Cancelling while the sensor is still waiting for a finger behaves as before.

Testing (138a:0097, Debian 13, 0.15)

  • Cancelled a verify 0.3 to 1.5 s after the finger was placed. Before: the 1.1 s cancel made the sensor drop off USB. After: 0 failures in 7.
  • 10 of 10 matches with the enrolled finger; other fingers rejected.
  • Cancelling with no finger on the sensor: unchanged, service keeps running.

🤖 Generated with Claude Code

A Cancel that arrives while match_finger() waits for the match interrupt
made the cleanup command (0x62) go out mid-match. On 138a:0097 the sensor
then drops off the USB bus and the service is left with a dead handle.

wait_int() gets a non-cancellable mode that gives up after max_wait
seconds, and match_finger() uses it so the match always finishes first.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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