PC board: an unreachable MQTT broker blocks the whole firmware

未关闭
#89 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
embedded-iot

调研方向

Start with boards/pc/src/network.rs and trace mqtt_driver_task and how the PC board runs tasks on its Embassy executor. Compare its connection path with the other stream code that uses Embassy timers. Done means an unreachable broker no longer blocks the BLE HTTP server, CAN, or vehicle tasks while MQTT retries; the issue does not name specific tests.

由索引模型根据 Issue 内容生成。

描述

bug

Problem

mqtt_driver_task on the PC board (boards/pc/src/network.rs) opens the broker connection with a blocking std::net::TcpStream::connect. The PC board runs every task on one Embassy executor thread, so while that connect waits, nothing else runs: no BLE test HTTP server, no CAN, no vehicle tasks, no state publishing.

A refused connection returns at once, so a local broker that is down is fine. An address that doesn't answer (a host that is off or not on the network) leaves the connect waiting for the OS TCP timeout, more than a minute on Linux. Then the 5 s retry starts it again, so the firmware is blocked almost all the time.

This hits anyone running the PC board straight from config.toml.example: its broker_url is mqtt://192.168.0.100:1883, which usually doesn't answer. The log stops at MQTT: connecting to 192.168.0.100:1883 and the BLE HTTP mock on port 4242 refuses connections. Found while testing #74 end to end on virtual-car; pointing broker_url at a closed local port (mqtt://127.0.0.1:1) works around it.

Proposal

  • Connect without blocking the executor: a non-blocking socket polled with Embassy timers (like the rest of the stream), or the connect on a separate thread with the result handed back.
  • Bound the connect with a timeout (a few seconds), then retry as today.
  • Optionally make the example config's broker one that fails fast, or document that the PC board needs a reachable broker or a closed local port.

Done when

With an unreachable broker, the PC board's BLE HTTP server, CAN and vehicle tasks keep working while MQTT retries.

主要语言
Rust
星标
1
派生
0
平均合并
13 小时 27 分钟
30 天内合并 PR
31

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenCarControls/firmware 的其他 Issue

查看 OpenCarControls/firmware 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。