Repository navigation
Keep OX Mobile alive when a host connection closes mid-write (SIGPIPE) - #341
Conversation
OX Mobile is a library started by UIKit or Android, so Rust's own startup, which ignores SIGPIPE, never runs. A write to a host connection whose peer has closed then ends the app with signal 13 and no crash report. An iPhone's unified log shows five such exits in the foreground in 27 minutes on TestFlight 1694.1. Ignore SIGPIPE before anything else starts, and check on the simulator that a write to a closed socket returns EPIPE. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
/queue 18cc302 |
|
In line to merge. Commit 5714b96 is reviewed with nothing blocking; it has entered the merge queue. |
|
/queue 5714b96 |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
On Monday evening (30 Nov, TestFlight 1694.1) OX Mobile vanished several times while Oscar switched between hosts, and iOS saved no crash report. The iPhone's unified log shows why. Between 20:48 and 21:15, five OX processes ended in the foreground with:
Domain 2, code 13 is signal 13,
SIGPIPE. A process that writes to a socket whose peer has closed getsSIGPIPE, and its default action ends the process. iOS writes no.ipsfor it.Rust binaries never see this, because Rust's startup sets
SIGPIPEtoSIG_IGNbeforemain. OX Mobile is a library that UIKit (gpui_ios_register_app) or Android (android_main) starts, so that startup never runs. Any write to a host connection that has just been closed, which a host switch, a network change or a host restart all cause, could kill the app.What changes
ignore_sigpipe()setsSIGPIPEtoSIG_IGNfirst thing ingpui_ios_register_appandandroid_main. Writes to a closed socket then fail withEPIPE, which the connection code already handles as a disconnect.--sigpipe-test(simulator only): writes to a Unix socket whose peer has been dropped, then printsOX Mobile survived a write to a closed socket: ….check-ios-launch.shruns it.libcbecomes a direct dependency of ox-mobile. It was already in the lockfile through ox-desk-core and ox-host-web.Evidence
Tested on the affected iPhone (iOS 27) with a development build of this branch. The test mode was enabled on the device, and an environment switch skipped the fix:
termination reported by launchd (2, 13, 13), the same as MondayOX Mobile survived a write to a closed socket: Broken pipe (os error 32), thenOX Mobile scene activeSo the check fails without the fix and passes with it. The simulator launch check in this PR's CI runs the same test.
Not in this PR
SO_NOSIGPIPEon each socket is unnecessary once the signal is ignored process-wide.std::env::argson Android. See Bound GPUI element depth with stacker and test a 2x stack margin on iOS #339.🤖 Generated with Claude Code