AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 22 Bitcoin

plugin: nwc: qt: fix thread safety bug

Public commit record

What the developer wrote

Authored by f321x

68/100 · Adequate
plugin: nwc: qt: fix thread safety bug

Call `NWCServer.event_handler_task.cancel()` on asyncio thread.

```
 File "/home/user/Documents/electrum/electrum/plugins/nwc/nwcserver.py", line 281, in restart_event_handler
   self.event_handler_task.cancel()
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
 File "/usr/lib64/python3.14/asyncio/base_events.py", line 829, in call_soon
   self._check_thread()
   ~~~~~~~~~~~~~~~~~~^^
 File "/usr/lib64/python3.14/asyncio/base_events.py", line 866, in _check_thread
   raise RuntimeError(
       "Non-thread-safe operation invoked on an event loop other "
       "than the current one")
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
```
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a programming mistake where a background task was being cancelled from the wrong thread, which could crash the NWC (Nostr Wallet Connect) plugin with a RuntimeError. The fix makes sure the cancellation happens on the correct asyncio thread. It is a reliability/bug-fix patch, not a security vulnerability that an attacker can directly exploit.

Recommended action

Treat as a normal stability fix. No urgent security response required. Users of the NWC plugin should update to avoid the crash when connections change.

Security signals we found

01

Thread-safety violation in asyncio task cancellation

02

Crash-only symptom (RuntimeError), no privilege escalation or data exposure evident

03

Fix uses existing helper run_sync_function_on_asyncio_thread

Risk score

Why this scored 22/100

Our methodology →
Potential impact 3/30
Exploitability 2/25
Stealth signal 2/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.