Repository navigation
fix(ci/serial): make FbuildSerialAdapter.close() reusable (FastLED/fbuild#592) - #3058
Conversation
…uild#592) The autoresearch recovery path in `ci/autoresearch/gpio.py` calls `client.close()` on a ping retry, then re-creates an `RpcClient` reusing the same `FbuildSerialAdapter` instance. The adapter's `close()` was calling `self._executor.shutdown(wait=False)`, which permanently kills the per-adapter thread executor — the next `_run_in_thread` call fails with `cannot schedule new futures after shutdown`. This was the second link in today's Teensy 4.0 failure chain (post-flash USB re-enumeration → `WebSocket forcibly closed` → close-and-reopen → this crash). With the executor shutdown removed, the same autoresearch recovery path now completes end-to-end and the OBJECT_FLED (FlexIO TX) driver produces correctly-timed WS2812 edges (~225/580/645/1000ns short HIGH / long HIGH / short LOW / long LOW — all detected by the live edge analyzer). The executor is still cleaned up at GC time when the adapter is dropped; nothing leaks because `FbuildSerialAdapter` is created per-`RpcClient` session. Tracker: FastLED/fbuild#592 §3.5 (FastLED-side seam closure). Stays in sync with the fbuild-daemon servicedef install (FastLED/fbuild#593).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
FbuildSerialAdapter Executor Lifecycle Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Stops
FbuildSerialAdapter.close()from permanently killing its per-adapterThreadPoolExecutor. The autoresearch recovery branch (ci/autoresearch/gpio.py:70) closes the adapter and reuses it for a freshRpcClient— the executor shutdown made the next_run_in_threadfail withcannot schedule new futures after shutdown.This was the second link in the Teensy 4.0 failure chain:
Verification (live, Teensy 4.0)
After this change + the matching fbuild fix (FastLED/fbuild#593), the OBJECT_FLED (FlexIO TX) autoresearch run no longer crashes on the recovery path. The raw-edge analyzer captures and decodes real WS2812 timing:
So the FlexIO driver itself is fine; this PR removes the layered-on crash that was masking the actual test progress.
Why removing it is safe
ThreadPoolExecutoris created inside__init__and lives for the adapter's lifetime; nothing else stashes a reference to it.RpcClientis garbage-collected), the executor's destructor cleans up.close()was leaving the adapter object alive but its executor dead. Removing the shutdown call restores the invariant that close is logically idempotent and reusable.Test plan
bash autoresearch teensy40 --object-fled --upload-port COM20no longer crashes on the post-flash USB re-enum recovery pathRefs: FastLED/fbuild#592, FastLED/fbuild#593
🤖 Generated with Claude Code
Summary by CodeRabbit