Repository navigation
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: kernelReviewers: @GorrayLi @ReviewSun @hamburger-os @lianux-mm @wdfk-prog @xu18838022837 Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-11-02 15:53 CST)
📝 Review Instructions
|
|
独立复现了一遍,现象和根因都对得上。补一组"第一次 / 第二次"的干净对照数据。 环境
复现方式msh 里分两次执行 结果第一次: 第二次: 断言原文是 根因确认:是四个标志没清/* mailbox_tc.c:60-61 */
static uint8_t static_mb_recv_thread_finish, static_mb_send_thread_finish;
static uint8_t dynamic_mb_recv_thread_finish, dynamic_mb_send_thread_finish;它们只在工作线程里置 1( 第二次运行时, 与 #11963 里 一个可能影响别人复现的坑
我第一次就是这么踩的:自动运行先跑了一次 PASSED,然后我的第一次手动运行就 FAILED 了。要拿到干净对照,需要同时确认 复现用的临时 app 没有提交,需要的话我可以整理成 |
|
感谢独立复现,根因和改法能对上就很难得 👍 关于 你的提醒很有价值 —— 我把它当成"复现前提"记下来了:如果 CI_ACTION/自动运行开着,开机那次会消耗掉"第一次" 另外:我已经把这个分支合到最新 master(现在是 你那个"临时 app 调用 |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
Fixes #6565 (the remaining half - see the note at the end).
core.ipc_mailboxfails when it is run a second time in the same boot. Reproduced onbsp/qemu-vexpress-a9withRT_USING_UTESTCASES=yandRT_UTEST_MAILBOX=y:Cause: the four
*_thread_finishflags are only ever set to 1 by the worker threads, nevercleared. On the second run the test body's wait loop
falls through immediately, so
rt_mb_detach()is called while the worker threads started bythis run are still blocked in
rt_mb_recv(). They are then resumed with an error and keepusing a mailbox that has already been detached, which trips the object-type assertion in
_rt_mb_recv(). The dynamic variant has the same pattern and would fail the same way.你的解决方案是什么 (what is your solution)
Clear the flags in
utest_tc_init(), which the utest framework calls before each run of thetestcase:
Only
src/utest/mailbox_tc.cis touched (+11/-0). This matches what has already been said in#6565: part of the testcases were written without considering that they can be executed twice,
leaving variables/resources not reset or released.
请提供验证的bsp和config (provide the config and bsp)
CONFIG_RT_USING_UTESTCASES=y,CONFIG_RT_UTEST_MAILBOX=y(enabled temporarily forthis verification; the BSP configuration itself is not part of this PR)
Verification (
utest_run core.ipc_mailboxexecuted three times in one session, after the fix):The same build without the fix fails on run 2 as shown above.
scons -j4passes andtools/ci/clang_format_check.pyreports "clang-format check success" for the changed file.Not covered: other BSPs / real hardware (only qemu-vexpress-a9 was tested), and running the
whole utest suite (
utest_runwithout arguments) - only the mailbox testcase was exercised.Note on the rest of #6565: the other reported problem,
thread_tc.c'stest_thread_suspendsuspending another thread (which hits
RT_ASSERT(thread == rt_thread_self())), was alreadyconfirmed by the maintainers as a testcase problem and that test is already disabled, so it is
not touched here.
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up