# \[Chapel Merge\] Fix race causing infinite loop with TaskErrors

**URL:** <https://chapel.discourse.group/t/chapel-merge-fix-race-causing-infinite-loop-with-taskerrors/52229>\
**Category:** Commits\
**Created:** [October 23, 2026, 1:01am UTC](https://chapel.discourse.group/t/chapel-merge-fix-race-causing-infinite-loop-with-taskerrors/52229 "2026-10-23T01:01:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chapelhpcBot](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chapelhpcBot](https://chapel.discourse.group/u/chapelhpcBot)\
**Post date:** [October 23, 2026, 1:01am UTC](https://chapel.discourse.group/t/chapel-merge-fix-race-causing-infinite-loop-with-taskerrors/52229/1 "2026-10-23T01:01:53Z")

</div>

Branch: fix-race-taskerrors  
Revision: 5bd50a2a79a7ee87bf2d5dad57b0a71d568d36e7  
Author: jabraham17  
Link: [Fix race causing infinite loop with TaskErrors by jabraham17 · Pull Request #29581 · chapel-lang/chapel · GitHub](https://github.com/chapel-lang/chapel/pull/29581)  
Log Message:  
Fix race causing infinite loop with TaskErrors

Fixes a race condition that could cause the compiler to create a TaskErrors object with a self-referential linked list, which would then be iterated and loop forever (and cause the program to hang).

This could occur because multiple tasks would write to a single task variable (and then read/modify it). Instead, tasks now write to a localize task error variable that is copied out at the end of the task.

[Reviewed by @benharsh]

Compare: [Fix race causing infinite loop with TaskErrors by jabraham17 · Pull Request #29581 · chapel-lang/chapel · GitHub](https://github.com/chapel-lang/chapel/pull/29581/changes)

Diff:  
M compiler/resolution/lowerIterators.cpp  
A test/errhandling/parallel/forall-error-per-task.1-1.good  
A test/errhandling/parallel/forall-error-per-task.1-2.good  
A test/errhandling/parallel/forall-error-per-task.chpl  
A test/errhandling/parallel/forall-error-per-task.execenv  
A test/errhandling/parallel/forall-error-per-task.execopts  
[https://github.com/chapel-lang/chapel/pull/29581.diff](https://github.com/chapel-lang/chapel/pull/29581.diff)
