Skip to content

Fix double close of stdio descriptors in cluster exec helpers - #2543

Open
SVilgelm wants to merge 1 commit into
apple:mainfrom
SVilgelm:fix-cluster-exec-fds
Open

SVilgelm wants to merge 1 commit into
apple:mainfrom
SVilgelm:fix-cluster-exec-fds

Conversation

@SVilgelm

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

XPCMessage.set(key:value:) closes the descriptor it sends. execCapture and runProbe sent one handle as stdout and stderr and then closed it themselves, so with concurrent execs (#2485 boots workers in parallel) another task's pipe could be closed: cluster start of a 1 + 2 cluster crashed 6/6 with NSFileHandleOperationException … Bad file descriptor. The helpers now send a duplicate, stdout only; the second send as stderr never attached, so behaviour is unchanged. With #2485 and this change, 4/4 starts succeed.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Sending a FileHandle over XPC closes its descriptor, and the helpers closed it
again, so a concurrent exec could lose its pipe. Send a duplicate, stdout only.

Assisted-by: Claude Code <[email protected]>
Signed-off-by: Sergey Vilgelm <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant