Skip to content

fix: detect worker task_done() crash + broaden DB CUCM fallback - #32

Merged
bandrel merged 1 commit into
mainfrom
fix/detect-worker-taskdone
Jul 29, 2026
Merged

fix: detect worker task_done() crash + broaden DB CUCM fallback#32
bandrel merged 1 commit into
mainfrom
fix/detect-worker-taskdone

Conversation

@bandrel

@bandrel bandrel commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to the SEP-name support in v0.13.0.

Crash fix

--brute-mac -p SEP<MAC> against an unreachable phone with no -H raised:

ValueError: task_done() called too many times

The detect worker's "invalid length" and "no CUCM" branches called queue.task_done() explicitly and then also hit finally: task_done() — a continue inside the try still runs the finally, so the item was acked twice and the worker thread died. Fixed by letting the finally own the single task_done().

Broaden DB CUCM fallback (requested)

When -H is absent and the phone is unreachable, after the exact-MAC lookup (get_cucm_for_mac_from_db) misses, fall back to a CUCM host already known in the database (union of credentials/phone_cucm/cluster_servers and mac_prefixes):

  • exactly one known host → use it,
  • more than one → list them and ask for -H rather than guessing.

Testing

  • Regression test capturing threading.excepthook proves the worker no longer raises.
  • Test for the sole-known-CUCM fallback.
  • Full suite: 248 passed, 2 skipped.
  • Validated live on the engagement host.

🤖 Generated with Claude Code

…lback

The detect worker's "invalid length" and "no CUCM" branches called
queue.task_done() and then hit the finally: task_done() as well, since a
continue inside the try still runs the finally. With an unreachable SEP phone
and no -H this raised "task_done() called too many times" and killed the
worker thread. Drop the explicit calls and let the finally own it.

Also broaden the no-H CUCM resolution the user asked for: after the exact-MAC
lookup misses, fall back to a CUCM host already known in the database (union of
credentials/phone_cucm/cluster_servers and mac_prefixes) when exactly one is
recorded; if several are, list them and ask for -H rather than guessing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bandrel
bandrel merged commit c35b78d into main Jul 29, 2026
2 checks passed
@bandrel
bandrel deleted the fix/detect-worker-taskdone branch July 29, 2026 18:19
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