Skip to content

Should serial monitor be fully async? Shared session core; promote AsyncSerialMonitor out of experimental #1485

Closed

Description

@zackees

Follow-up to #1431 / #1484. Downstream: FastLED/FastLED#4656.

Decision: AsyncSerialMonitor becomes a supported API. The sync SerialMonitor and AsyncSerialMonitor share one session core, and each exposes its own Python API.


1. Current state

SerialMonitor (sync) AsyncSerialMonitor
Code serial_monitor.rs + ws_session.rs (after #1484) async_serial_monitor.rs + async helpers in json_rpc.rs
Users FastLED, via a thread-pool adapter none
Tests fake-daemon Rust tests in ws_session.rs none
Write during a long read fixed in #1484 (ReadYield hand-off) stalls: write_async waits for write_ack while holding the shared read half (json_rpc.rs:117-150), which a concurrent read_lines holds for its whole timeout
RPC reply stolen by a concurrent reader fixed in #1484 (RpcRoute) broken: write_json_rpc polls read_lines_async (json_rpc.rs:161-186)
Overlapping requests swap replies fixed in #1484 (request lock) broken
Cancellation loses lines n/a possible: lines pulled into a batch that is never delivered
API gaps — write -> bool (sync returns bytes); reset_device has no wait_for_output/timeout; no in_waiting, run_until or reset_input_buffer; uses timeout_secs= (sync uses timeout=)

#1484's hand-off design works, but it is a polling hand-off: 1 ms yield polls and a 50 ms RPC slice. It can't be reused from async code without re-deriving it on tokio mutexes.

2. Protocol facts the design relies on (verified in the daemon)

crates/fbuild-daemon/src/handlers/websockets.rs:

  • Request order. The inbound task handles one client message at a time and awaits each Write before reading the next (≈ lines 578-660). So write_ack and in_waiting replies arrive in the order their requests were sent. There are no request ids, so replies must be matched by FIFO order.
  • An error can replace an ack. A base64 decode failure sends {"type":"error"} instead of a write_ack. The FIFO must treat error as the reply to the head pending request, or every later reply shifts by one.
  • clear_buffer has no reply. It must not enter the pending-reply FIFO.
  • Data and replies interleave arbitrarily. data frames come from the daemon's broadcast-reader task through the same out_tx. A serial line can arrive before or after any ack.
  • No REMOTE: protocol at the daemon. JSON-RPC replies are ordinary serial lines starting with REMOTE: (see json_rpc.rs::extract_remote_json_rpc_response).
  • Port events are unsolicited: preempted, reconnected, port_disconnected, port_renumbered, port_reattached, port_rebind_failed.

If any of these facts changes on the daemon side, the design must change with it. Add a daemon-side test that pins "replies are emitted in request order".

3. Target architecture

                       ┌────────────────────────── serial_session.rs ───────────────────────────┐
 WebSocket read half ──► reader task (one per session, owns WsSource)                            │
                       │   data lines ─(REMOTE:, RPC waiting)──► rpc slot    (oneshot per RPC)    │
                       │   data lines ─(everything else)───────► line queue  (bounded, Notify)    │
                       │   write_ack / in_waiting / error ─────► reply FIFO  (oneshot per request)│
                       │   port events ────────────────────────► status      (watch)              │
                       │ write path: sink mutex + "register pending reply, then send", atomically │
                       └───────────────▲──────────────────────────────────────▲───────────────────┘
                                       │                                      │
              serial_monitor.rs (sync facade)              async_serial_monitor.rs (async facade)
              waits on channels with py.detach             future_into_py over the same calls
  • New module: crates/fbuild-python/src/serial_session.rs, or a serial_session/ directory with a README. It is a module, never a new crate (monocrate policy).
  • ws_session.rs and the async loops in json_rpc.rs are deleted. extract_remote_json_rpc_response can stay.
  • SerialSession is a plain Rust type with no PyO3 in it, so every concurrency property can be tested without a Python interpreter.

Core API (Rust)

pub(crate) struct SerialSession { /* Arc<Inner>, reader JoinHandle, runtime handle */ }

impl SerialSession {
    pub async fn connect(cfg: SessionConfig) -> Result<Self, SessionError>;            // attach handshake (5 s cap)
    pub async fn read_lines(&self, timeout: Duration) -> Vec<String>;                  // cancel-safe
    pub async fn write(&self, data: &[u8], timeout: Duration) -> Result<usize, SessionError>;
    pub async fn json_rpc(&self, line: &str, timeout: Duration) -> Result<String, SessionError>; // returns JSON after "REMOTE:"
    pub async fn in_waiting(&self, timeout: Duration) -> Result<usize, SessionError>;
    pub async fn clear_input(&self);                                                   // local queue + clear_buffer
    pub fn status(&self) -> watch::Receiver<SessionStatus>;
    pub async fn close(self);                                                          // detach, close, join reader
}

Each facade's blocking or awaitable call is a thin wrapper over these methods.

4. Implementation guidelines

4.1 Reader task

  • Sole owner of WsSource. Nothing else ever reads the socket. This deletes ReadYield, RpcTurn/RpcRoute, pending and the request lock from fix(python): let SerialMonitor.write run while read_lines is in flight (#1431) #1484.
  • Frame dispatch:
    • data: for each line, if an RPC waiter is registered and the line starts with REMOTE:, complete the oldest RPC waiter's oneshot. Otherwise push it to the line queue.
    • write_ack / in_waiting / error: pop the head of the reply FIFO and complete it. If the kind doesn't match the head's kind (for example in_waiting arriving while the head is a Write), fail the head with ProtocolDesync and log loudly. Never silently re-order.
    • Port events: update the watch status.
      • preempted blocks readers only when auto_reconnect == false.
      • port_disconnected / port_rebind_failed wake all readers with an empty result and fail every pending reply with PortGone.
    • close / stream end: mark the session closed, wake everyone, fail all pending replies with Closed, and exit.
  • Keep the task non-blocking. No std::sync::Mutex held across .await. Use parking_lot or a short std lock around queue operations only, or a tokio mutex if an await is unavoidable.

4.2 Write path, where ordering matters

  • Register, then send, atomically. Take the sink mutex, push a oneshot to the reply FIFO, then send, then release the sink. Registration and send must happen under the same lock. Otherwise two writers can register in one order and send in the other.
  • Send failure. Remove your FIFO entry before releasing the lock, or mark it abandoned (see timeouts).
  • Timeouts and cancellation. A waiter that gives up must not break the FIFO. Leave the entry in place but mark it abandoned: its receiver is dropped, so oneshot::Sender::send returns Err and the reader simply discards the reply. Never remove a sent request's entry: the daemon will still answer it.
  • clear_input (clear_buffer) takes the sink lock but does not register a reply.
  • Bounded send. send on the sink is wrapped in the caller's timeout, default 5 s. If the daemon stops reading and the TCP buffer fills, the call fails with Timeout. The sink lock is released on every path, so one wedged send can't stall every other writer forever.
    • A send that times out mid-frame leaves the WebSocket in an unknown state, so the session is marked Closed (fail everything, wake everyone). That is better than silently desyncing.

4.3 Read path

  • Line queue: VecDeque<String> plus tokio::sync::Notify, bounded at max_buffered_lines, default 10 000.
  • Overflow policy (maintainer to confirm): drop the oldest lines, count them, and surface the count (a lines_dropped getter plus a tracing::warn! once per burst). Do not stop reading the socket when the queue is full: that would stall write_acks, which travel on the same socket. Blocking is therefore not an option here.
  • read_lines(timeout) returns immediately with everything queued, if anything is. Otherwise it waits for Notify, a status change, or the deadline. It returns at most one batch, the whole queue at wake time.
  • Cancel safety. Lines are only removed from the queue inside a synchronous critical section that also returns them. Dropping the read_lines future before that point removes nothing, so no data is lost. This is a hard requirement for the async facade (AT-6).
  • Multiple concurrent readers are allowed. Each line is delivered to exactly one reader, whichever drains first, as today. Document it.
  • Abandoned-reader rule (FastLED #3219, "every 2nd RPC times out"). A read whose caller has gone away must never consume lines.
    • Async: a cancelled read_lines future removes nothing (cancel safety above).
    • Sync: a blocked read_lines thread cannot be cancelled from Python today. Add SerialMonitor.interrupt_reads(). It is an additive, backward-compatible method: it wakes every blocked sync reader, which returns [] without draining, so queued lines stay for the next reader.
    • With that, FastLED's adapter calls interrupt_reads() from its generator's finally instead of relying on a 50 ms polling cap.

4.4 JSON-RPC

  • Registration order. json_rpc registers an RPC waiter (a FIFO of oneshots) before writing the request line, then awaits the write's ack and then its REMOTE: reply. There is no request id matching today, so replies are FIFO too. Keep that and document it. Id matching is a possible follow-up.
  • Where REMOTE: lines go. While any RPC waiter is registered, REMOTE: lines never reach read_lines. When none is registered, they are ordinary lines. That is the current behaviour, keep it.
  • Stale replies. An RPC that times out leaves its slot abandoned. A late REMOTE: for it must be discarded, not delivered to the next RPC. Track a per-slot abandoned flag, or a generation counter.

4.5 Reconnect and deploy preemption

  • auto_reconnect keeps today's semantics:
    • After preempted, readers keep waiting until reconnected.
    • Pending writes fail with a typed Preempted error. They must not hang until timeout.
  • reset_device (sync and async) closes the session (close() joins the reader), posts /api/reset as today, reconnects by creating a new reader task, and optionally waits for output.
    • Hold an exclusive facade-level guard: &mut self on sync, and an async RwLock write guard on async.
    • Calls that overlap a reset get a clear error, never a hang.

4.6 Sync facade (SerialMonitor)

  • Python API unchanged, byte for byte (crates/CLAUDE.md consumer contract): names, defaults, return types, hooks, last_line, in_waiting, run_until, reset_input_buffer, reset_device(board, wait_for_output, timeout), write -> int.
  • Blocking calls. Every blocking call runs py.detach(|| rt.block_on(session.op(...))). Guard against calling from inside the runtime: block_on panics if already on a runtime thread, so detect it and return a Python RuntimeError.
  • Hooks are called with the GIL held, after the lines are returned, as today.
  • Exclusive access. __enter__, __exit__ and reset_device stay &mut self, so PyO3 raises RuntimeError: Already borrowed for overlapping lifecycle calls instead of racing.

4.7 Async facade (AsyncSerialMonitor)

  • API table (this becomes the public contract, documented in docs/architecture/pyo3-bindings.md and in class docstrings):
method signature returns
ctor AsyncSerialMonitor(port, baud_rate=115200, auto_reconnect=True, verbose=False) —
__aenter__ / __aexit__ — self / False
read_lines read_lines(timeout=30.0) (keep timeout_secs= as a deprecated alias for one release) list[str]
write write(data: str) int bytes written (breaking change from bool, call it out in release notes)
write_json_rpc write_json_rpc(request: dict, timeout=5.0) dict
in_waiting awaitable method in_waiting() (a property can't be awaited) int
reset_input_buffer reset_input_buffer() None
reset_device reset_device(board=None, wait_for_output=False, timeout=5.0) bool
  • Awaitables. All of them come from pyo3_async_runtimes::tokio::future_into_py over the shared SerialSession. Futures capture an Arc to the session, never &self.
  • Cancellation. Cancelling the asyncio task cancels the Rust future (pyo3-async-runtimes propagates it). Combined with §4.3, no data is lost and no reply slot desyncs (§4.2).
  • Remove the experimental wording from the docstrings and from python/fbuild/api/__init__.py.

4.8 Errors

Map SessionError in one place to Python exceptions: Timeout → TimeoutError, Closed/PortGone/Preempted → ConnectionError (with the reason), ProtocolDesync → RuntimeError.

For compatibility, the sync write keeps returning 0 on failure. The async write raises. Document the difference.

4.9 Deadlock-freedom rules (enforced, not just documented)

  1. No lock held across .await. Enforce with #![deny(clippy::await_holding_lock, clippy::await_holding_refcell_ref)] on the session module.
  2. No lock held while calling into Python. Hooks, run_until conditions and exception construction run only after every core lock is released. So a hook may call mon.write() / mon.write_json_rpc() / mon.read_lines() re-entrantly.
  3. Fixed lock order, documented at the top of the module: sink → reply FIFO → line queue → status. The reader task only ever takes reply FIFO, line queue and status, and never sink.
  4. The GIL is released for every call that can block, including __enter__ (handshake), __exit__ (detach + join), write, write_json_rpc, in_waiting, reset_input_buffer and reset_device, not just read_lines.
  5. No block_on on a runtime thread. Before blocking, the sync facade checks tokio::runtime::Handle::try_current(). If the caller is already on a runtime thread, it raises RuntimeError("SerialMonitor called from inside the async runtime; use AsyncSerialMonitor") instead of panicking or deadlocking.
  6. Reader-task death is observable. The reader task runs under a guard (scopeguard/Drop) that, on panic or exit, marks the session Closed, completes every pending oneshot with an error and wakes every reader. Nobody waits on a dead task.
  7. Drop without __exit__ (GC, exception in the with body, a leaked object) runs the same teardown as close(): detach best-effort, abort the reader, wake everyone.

4.10 Observability

Add tracing spans per request: kind, queue depth and latency. Use a debug! for every FIFO completion and a warn! for desync, drop and abandoned replies. No new env vars.

5. Acceptance tests

Every AT runs against both facades' shared core, and the AT-P tests run again through each Python facade. Each AT must be shown red first: run against today's AsyncSerialMonitor path (or a deliberately broken core), with the output of the red run pasted in the PR. Timing bounds are generous (≥10× the expected value) so CI can't flake.

5.1 Core tests: Rust, fake daemon, no Python

Extend the fake-daemon harness from ws_session.rs (tokio_tungstenite::accept_async, set_nodelay(true)). Give it knobs for echo delay, ack delay, injected error frames, injected port events, and dropping the connection.

ID Scenario Pass criteria
AT-1 Write during a 10 s read_lines from another task/thread write returns Ok(n) in < 1 s; the reader gets the echoed line; the reader returns in < 5 s, not at 10 s
AT-2 json_rpc while another task sits in read_lines(10 s); the reply arrives 150 ms later (several empty slices) RPC returns the reply JSON; the concurrent reader never sees a REMOTE: line
AT-3 32 concurrent writers × 5 rounds, distinct payload lengths every writer gets its own bytes_written
AT-4 write and in_waiting interleaved from 16 tasks each gets the right reply type and value; no timeouts
AT-5 fake daemon answers one write with error (the bad-base64 path) that write fails; the next write still gets its own ack (no FIFO shift)
AT-6 cancel read_lines futures (tokio::time::timeout 1 ms, select! drop) 1 000× while lines stream in total delivered lines == total sent, in order, no duplicates
AT-7 a writer times out waiting (daemon ack delayed past the timeout), then another write the late ack is discarded; the second write gets its own ack
AT-8 RPC times out; its late REMOTE: arrives during a second RPC the second RPC gets its own reply, not the stale one
AT-9 preempted → reconnected with auto_reconnect=true readers keep waiting and then get post-reconnect lines; a write during preemption fails fast with Preempted (< 1 s), not at its timeout
AT-10 port_disconnected / connection drop all blocked readers return promptly; pending writes/RPCs fail with PortGone/Closed; close() joins the reader task (no leaked task: assert the JoinHandle finished)
AT-11 overflow: 50 000 lines with nobody reading, max_buffered_lines = 10 000 the oldest are dropped; lines_dropped == 40 000; writes still get acks throughout (the socket keeps draining)
AT-12 clear_input with lines queued the queue is empty; clear_buffer is sent; the next ack still matches (clear registers no reply)
AT-13 throughput sanity: 10 000 request/reply round trips on loopback median < 5 ms; no desync warnings (assert on a captured tracing subscriber)
AT-14 abandoned reader (FastLED #3219): reader A is blocked in read_lines(10 s) and is then abandoned (async: future dropped; sync: interrupt_reads()); a request goes out and reader B reads B receives the reply line; A returns [] promptly and consumed nothing; repeat 100× with no "every 2nd RPC" failures
AT-15 peer stops reading (the fake daemon stops polling its socket; TCP buffer fills) write fails with Timeout within its timeout plus 1 s; the sink lock is released; the session reports Closed; concurrent readers return promptly
AT-16 handshake stall: TCP accept but no WebSocket handshake / no attached connect fails with Timeout in ≤ 5 s + slack; no leaked task
AT-17 reader-task death: a test-only fault hook panics the reader task mid-stream all blocked read_lines/write/json_rpc return errors in < 1 s; later calls fail fast with Closed
AT-18 malformed frames: garbage text, unknown type, binary frames, JSON missing fields ignored with a debug!; the session keeps working; no FIFO shift
AT-19 chaos soak (deadlock and stall detector). 64 tasks run a random mix of read_lines, write, json_rpc, in_waiting, clear_input and cancellations for 30 s, against a daemon with random delays (0-50 ms), injected error frames, preempted/reconnected pairs and one mid-run disconnect plus reconnect no call exceeds its own timeout + 1 s (per-call watchdog); every write gets exactly its own ack or a typed error; every line is delivered exactly once or counted as dropped; the reader task is joined at the end. Seeded RNG, and the seed is printed on failure
AT-20 teardown races: close() while 16 calls are in flight, 100 iterations every in-flight call returns within 1 s with Closed; no panic; no leaked task (JoinHandle::is_finished)

5.2 Python facade tests: Rust integration tests that embed CPython

The repo requires tests in Rust, and GIL, PyO3-borrow and asyncio behaviour can only be observed from Python. So these are Rust integration tests (crates/fbuild-python/tests/python_facades.rs) that embed an interpreter via PyO3, register the _native module, and drive Python code with py.run/py.eval. The fake daemon runs in a separate OS process (a small test binary, or the harness in a std::process::Command child), because __enter__ blocks on the handshake.

ID Facade Scenario Pass criteria
AT-P1 sync Python thread A in read_lines(timeout=10), thread B calls write ×10 no exception; each write returns its byte count in < 50 ms; A receives all echoes (#1431 regression)
AT-P2 sync thread A reading, thread B write_json_rpc ×10 each returns the matching dict; A never sees REMOTE:
AT-P3 sync GIL release: while thread A blocks in read_lines(2), thread B runs a pure-Python counter loop B makes progress, measured as a counter increase above a floor, during A's wait
AT-P4 sync __exit__ while another thread reads RuntimeError (borrow) or a clean return, never a hang or crash; the reader thread returns
AT-P5 async asyncio.gather(mon.read_lines(10), writes×10) all writes return ints; all echoes delivered; wall time < 2 s
AT-P6 async write_json_rpc concurrent with a long read_lines correct replies; the reader never sees REMOTE:
AT-P7 async cancel read_lines tasks repeatedly (asyncio.wait_for(..., 0.001) ×500) while lines stream no lines lost or duplicated; no InvalidStateError/panic
AT-P8 async reset_device(board=None, wait_for_output=True, timeout=5) against the fake daemon's /api/reset stub returns True; the session is usable afterwards (write + read round trip)
AT-P9 both API contract: introspect signatures and defaults against the §4.6/§4.7 tables exact match (this pins the consumer contract)
AT-P10 sync FastLED #3219 replay: the adapter pattern (reader thread per request, consumer abandons it after the reply) with interrupt_reads() in finally, 100 RPCs 100/100 RPCs succeed; none waits for its timeout
AT-P11 sync GIL matrix: for each blocking method (__enter__, read_lines, write, write_json_rpc, in_waiting, reset_input_buffer, reset_device, __exit__), a second Python thread counts while the call blocks against a slowed fake daemon the counter advances during every call
AT-P12 sync in-process peer deadlock (the one we hit while validating #1484): the fake daemon runs as an asyncio server in a Python thread of the same process __enter__, write and read_lines all succeed (possible only once the GIL is released everywhere)
AT-P13 sync re-entrancy: a hooks=[...] callback calls mon.write() and mon.write_json_rpc(); a run_until condition calls mon.write() completes; no deadlock; replies delivered
AT-P14 sync a sync method called from inside a coroutine on the pyo3 runtime thread (via AsyncSerialMonitor callbacks) raises RuntimeError with the guidance message; no panic, no hang
AT-P15 async __aexit__ while read_lines/write/write_json_rpc are awaited in other tasks the pending awaitables raise ConnectionError in < 1 s; __aexit__ completes
AT-P16 both drop without exit: create, enter, start a read, drop every reference and gc.collect() the reader task terminates (test-only live-session counter returns to 0); the daemon sees a detach or close

Gating. AT-P tests need libpython at link time and at runtime. Mark them #[ignore = "embeds CPython; run by the python-facade CI job"] and add a CI job (Linux; Windows too if feasible) that runs them with --ignored under the pinned Python.

5.3 Hang-to-failure harness (required for every AT)

A deadlock must fail fast with evidence, never burn CI's job timeout:

  • Rust async tests: wrap each body in tokio::time::timeout(TEST_BUDGET, …). On expiry, dump the core's state (FIFO depth and kinds, queue length, status, JoinHandle finished?) and panic.
  • Rust sync or threaded tests: run the body on a spawned thread and join with a deadline (std::sync::mpsc::recv_timeout). On expiry, print the core state and std::process::abort(), so the test binary can't hang.
  • Embedded-Python tests: each snippet starts with faulthandler.dump_traceback_later(TEST_BUDGET, exit=True), so a hang prints every Python thread's stack and exits.
  • CI: the python-facade job and the unit job have timeout-minutes set well above the sum of the budgets, as a last resort only.

5.4 Failure-case coverage audit

Every failure observed so far maps to at least one test:

Observed failure Where seen Covered by
write waits out a concurrent read_lines (stall) #1431, FastLED#4343 (~220 ms per RPC) AT-1, AT-P1, AT-P5
RuntimeError: Already mutably borrowed / dead liveness probe with 2 workers #1431, #1484 A/B AT-P1, AT-P2, AT-P4
RPC reply stolen by a concurrent reader CodeRabbit on #1484 AT-2, AT-P2, AT-P6
overlapping requests swap or drop replies (in_waiting → 0, write → 0) CodeRabbit on #1484 AT-3, AT-4
error frame replaces an ack → FIFO shift daemon code (bad base64) AT-5, AT-18
every 2nd RPC times out: an abandoned reader eats the reply FastLED #3219 AT-14, AT-P10
GIL held while blocking → other Python threads starve; in-process peer deadlock #1484 validation (handshake timeout) AT-P3, AT-P11, AT-P12
cancellation loses lines AsyncSerialMonitor code review AT-6, AT-P7
late ack or late RPC reply misattributed design review AT-7, AT-8
writers wedged behind a send to a peer that stopped reading design review AT-15
hang on a peer that never finishes the handshake 5 s cap exists and is untested AT-16
waiting forever on a dead reader task design review AT-17, AT-20
re-entrant hook or run_until deadlock design review AT-P13
block_on panic inside the runtime design review AT-P14
teardown while calls are in flight design review AT-P4, AT-P15, AT-20
leaked session or task on GC design review AT-P16
unknown deadlocks and stalls under realistic contention — AT-19 chaos soak + §5.3 watchdogs

5.5 End-to-end smoke (manual, recorded in the PR)

Real daemon and a real board (RP2350W or ESP32-S3):

  • FastLED's ci/rpc_client.py ping median, before and after, through the thread-pool adapter (sync) and through a quick asyncio-native adapter (async).
  • The expected result for both is ≈ wire time + ~50 ms, versus ~110 ms today.

6. Delivery plan and definition of done

PR 1: core + sync facade

  • serial_session.rs with AT-1…AT-20, each shown red first against the old async path where applicable, all under the §5.3 watchdogs.
  • SerialMonitor on the core. Delete ws_session.rs.
  • AT-P1…AT-P4, AT-P9 (sync part), AT-P10…AT-P14 and AT-P16 (sync part), plus the python-facade CI job.
  • interrupt_reads() added (additive, so the sync API stays compatible).
  • No change to the sync Python API.

PR 2: async facade

  • AsyncSerialMonitor on the core with the §4.7 API. Delete the async loops in json_rpc.rs.
  • AT-P5…AT-P9, AT-P15 and AT-P16 (async part).
  • Docs: docs/architecture/pyo3-bindings.md (concurrency model, both API tables, error mapping, overflow policy) and python/fbuild/api.
  • Remove the experimental wording. Release-note the write -> int change and the timeout_secs deprecation.

Every PR must pass:

  • clippy -D warnings, rustdoc -D warnings and bash test;
  • the new CI job;
  • CodeRabbit resolved;
  • before/after latency numbers.

Then:

7. Open questions for the maintainer

  1. Overflow policy: drop-oldest with a counter (proposed) vs. an error. Blocking is ruled out by §4.3.
  2. in_waiting on async: an awaitable method (proposed) vs. keeping it sync-only.
  3. The write -> int breaking change on async: acceptable, given there are no known users?
  4. JSON-RPC id matching instead of FIFO: in scope here, or a follow-up?
  5. interrupt_reads(): acceptable as the additive sync API for abandoning blocked reads (FastLED #3219)? The alternative is a read_lines(timeout, cancel=threading.Event) kwarg.

Activity

  1. zackees commented on Sep 26, 2026

    @zackees
    MemberAuthor

    Downstream: FastLED/FastLED#4656 tracks FastLED's adapter change.

  2. changed the title [-]Should serial monitor be fully async? Shared session core; promote AsyncSerialMonitor out of experimental[/-] [+]Serial monitor: shared async session core; promote AsyncSerialMonitor out of experimental[/+] on Sep 26, 2026
  3. changed the title [-]Serial monitor: shared async session core; promote AsyncSerialMonitor out of experimental[/-] [+]Should serial monitor be fully async? Shared session core; promote AsyncSerialMonitor out of experimental[/+] on Sep 26, 2026
  4. zackees commented on Sep 27, 2026

    @zackees
    MemberAuthor

    Delivered as one combined shared-core/sync/async PR per the agreed delivery choice: #1490 merged, released in v2.5.29 (https://github.com/FastLED/fbuild/releases/tag/v2.5.29), with the FastLED native-async adapter and 2.5.29 pin merged in FastLED/FastLED#4657. The Pico 2 smoke recorded 30/30 pings and a 44.36 ms median versus the 110.27 ms thread-pool baseline. The separate local embedded-Python loader-path follow-up remains open as #1487.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions