fix: detach ithreads and close client socket for Windows#21
Closed
fix: detach ithreads and close client socket for Windows#21
Conversation
…ead test The ithreadm.t test was disabled on Windows because the server process would terminate after the second client thread connected. Two issues in the ithreads code path contributed to this: 1. ChildFunc created threads but never detached them. The thread object was immediately discarded, causing undefined cleanup behavior when it went out of scope — on Windows this can terminate the process. 2. In the Bind accept loop, the parent's copy of the client socket was only closed explicitly in fork mode. In ithreads mode, the parent held the socket until GC, which on Windows can cause handle conflicts with the child thread's dup'd copy. Now ithreads mode also calls ServClose on the client socket after spawning the child thread, matching fork mode behavior. Fixes #19 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d2d1740 to
f17445e
Compare
Author
Rebase: fix: detach ithreads and close client socket for WindowsBranch Diff: 2 files changed, 3 insertions(+), 7 deletions(-) Actions
CICI still failing after 2 fix attempts. Last failure logsAutomated by Kōan |
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.
Summary
Fixes the
t/ithreadm.ttest failure on Windows by addressing two issues in the ithreads server code path:Thread detachment:
ChildFunccreated threads but never calleddetach(), so the thread object was immediately discarded. On Windows, this undefined cleanup behavior can terminate the process after the second client connects.Client socket cleanup: After spawning a child thread, the parent's copy of the accepted client socket was only closed explicitly in fork mode. In ithreads mode it lingered until GC, which on Windows can cause handle conflicts with the child thread's dup'd copy. Now ithreads mode also calls
ServCloseafter spawning, matching fork mode.With these fixes, the Windows skip in
t/ithreadm.tis removed.Fixes #19
Changes
detach()threads created inChildFunc(ithreads mode)t/ithreadm.tTest plan
Generated by Kōan /fix
Quality Report
Changes: 2 files changed, 3 insertions(+), 7 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline