OpenCyphal / OpenCyphal/pycyphal

DiagnosticPublisher attempts to use the main asyncio event loop from worker threads (which fails)

Open
#336 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

class-defect domain-core help wanted severity-major
Dominant language
Python
Stars
142
Forks
110
PR merge metrics
No merged PRs in 30d

Description

Here, the call to ensure_future is invalid because emit can be invoked from any thread while we must use the asyncio loop from the node thread:

https://github.com/OpenCyphal/pycyphal/blob/40e14821285f48ad997cb3f7a8457d79a88db082/pycyphal/application/diagnostic.py#L187

Related: #334

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pycyphal/application/diagnostic.py around emit and the ensure_future call referenced in the issue. Check how the node thread's asyncio loop is obtained and how emit may be invoked from worker threads; done means scheduling works from those threads without using the loop directly from the wrong thread, with relevant behavior covered by the existing test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.