[pull] master from mruby:master#187
Merged
pull[bot] merged 6 commits intosysfce2:masterfrom Feb 14, 2026
Merged
Conversation
Old code:
```c
t = q_ready_;
/* No task ready - check if all tasks are done */
if (!t) {
/* If there are tasks waiting or suspended, idle */
if (q_waiting_ || q_suspended_) {
mrb_hal_task_idle_cpu(mrb);
continue;
```
IRQ possibly happens between `t = q_ready_;` and `if (q_waiting_ || q_suspended_) {` and, for example, a waiting task may move to the ready queue.
As a result, the infinite loop in mrb_task_run unexpectedly breaks in spite of not all the task is dormant.
This patch fixes the issue above by setting the `exitting` condition with a critical section.
The current implementation of `task_init_context` inheriting a receiver from the parent task is unstable and causes critical faults, especially on microcontrollers. - It leads to a HardFault on devices like Raspberry Pi Pico 2 by accessing a potentially NULL `mrb->c->ci`. - Even when `mrb->c->ci` is not NULL, this incomplete context copy causes other memory errors (SEGV). This patch reverts to the safer, previous behavior, that I implemented in picoruby/picoruby, of always initializing a new task's receiver to `top_self`, ensuring predictable and robust operation. The issue was likely masked on POSIX systems due to the unpredictable nature of undefined behavior.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fix mruby-task: wrapping by critical section and setting initial task receiver to top_self
The prek-action already passes --color=always internally, so passing it again via extra-args causes a CLI error. Co-authored-by: Claude <noreply@anthropic.com>
move fd, fd2, pid fields before the bitfield flags while keeping the pointer field last. this preserves the 24-byte struct size (same as 3.4.0) while restoring fd to offset 0 (same as 3.3.0). some external gems (e.g. mruby-polarssl) pass struct mrb_io pointers directly to libraries like mbedtls that expect an int fd at offset 0. the 3.4.0 reorder moved bitfield flags to offset 0, causing these gems to read garbage instead of the file descriptor. fixes #6713 Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )