[Backport][0.9 to 0.8] | [Backport][main to 0.9] | Fix crash in threads_create_join on partial failure (#1252) (#1328) - #1393
Merged
lihuiba merged 1 commit intoJun 16, 2026
Conversation
… failure (#1252) (#1328) * Fix crash in threads_create_join on partial failure (#1252) * Fix crash in threads_create_join on partial failure When thread_create() fails mid-loop, only join threads that were actually created. Previously the join loop iterated all n slots, calling thread_join on uninitialized pointers (stack array case) or nullptr (vector case), causing a segfault. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address review: return # of threads created, use created++ index Per maintainer feedback: - threads_create_join now returns the actual number of threads created (< n on partial failure), so callers can detect partial failure. - Use pthreads[created++] = th instead of a separate created++ line. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * Update thread.h * Update thread.h --------- Co-authored-by: Jiangtian Feng <fengjiangtian.fjt@alibaba-inc.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Huiba Li <huiba.lhb@alibaba-inc.com>
lihuiba
approved these changes
Jun 16, 2026
photonlibos
deleted the
backport-pr-465203011306b2acabc014bb9fbab5252f06f071-0.8
branch
June 16, 2026 06:52
lihuiba
added a commit
that referenced
this pull request
Jun 17, 2026
… failure (#1252) (#1328) (#1393) (#1428) * Fix crash in threads_create_join on partial failure (#1252) * Fix crash in threads_create_join on partial failure When thread_create() fails mid-loop, only join threads that were actually created. Previously the join loop iterated all n slots, calling thread_join on uninitialized pointers (stack array case) or nullptr (vector case), causing a segfault. * Address review: return # of threads created, use created++ index Per maintainer feedback: - threads_create_join now returns the actual number of threads created (< n on partial failure), so callers can detect partial failure. - Use pthreads[created++] = th instead of a separate created++ line. --------- * Update thread.h * Update thread.h --------- Co-authored-by: Jiangtian Feng <fengjiangtian.fjt@alibaba-inc.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Huiba Li <huiba.lhb@alibaba-inc.com>
lihuiba
added a commit
that referenced
this pull request
Jun 17, 2026
… failure (#1252) (#1328) (#1393) (#1428) (#1459) * Fix crash in threads_create_join on partial failure (#1252) * Fix crash in threads_create_join on partial failure When thread_create() fails mid-loop, only join threads that were actually created. Previously the join loop iterated all n slots, calling thread_join on uninitialized pointers (stack array case) or nullptr (vector case), causing a segfault. * Address review: return # of threads created, use created++ index Per maintainer feedback: - threads_create_join now returns the actual number of threads created (< n on partial failure), so callers can detect partial failure. - Use pthreads[created++] = th instead of a separate created++ line. --------- * Update thread.h * Update thread.h --------- Co-authored-by: Jiangtian Feng <fengjiangtian.fjt@alibaba-inc.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Huiba Li <huiba.lhb@alibaba-inc.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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix crash in threads_create_join on partial failure (Fix crash in threads_create_join on partial failure #1252)
Fix crash in threads_create_join on partial failure
When thread_create() fails mid-loop, only join threads that were
actually created. Previously the join loop iterated all n slots,
calling thread_join on uninitialized pointers (stack array case)
or nullptr (vector case), causing a segfault.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Per maintainer feedback:
(< n on partial failure), so callers can detect partial failure.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Co-authored-by: Claude Opus 4.6 noreply@anthropic.com
Update thread.h
Update thread.h
Co-authored-by: Jiangtian Feng fengjiangtian.fjt@alibaba-inc.com
Co-authored-by: Claude Opus 4.6 noreply@anthropic.com
Co-authored-by: Coldwings coldwings@me.com
Co-authored-by: Huiba Li huiba.lhb@alibaba-inc.com
Generated by Backport Auto PR, by cherry-pick related commits.
Please review and decide whether to merge or close this backport PR.