Skip to content

Keep OX Mobile alive when a host connection closes mid-write (SIGPIPE) - #341

Merged
n0rpan merged 2 commits into
mainfrom
fix/mobile-ignore-sigpipe
Dec 3, 2026
Merged

n0rpan merged 2 commits into
mainfrom
fix/mobile-ignore-sigpipe

Conversation

@n0rpan

@n0rpan n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

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:

runningboardd: [app<dev.ox.mobile(…)>:55164] termination reported by launchd (2, 13, 13)
               exitStatusDomain=2 exitStatusCode=13 foreground=YES

Domain 2, code 13 is signal 13, SIGPIPE. A process that writes to a socket whose peer has closed gets SIGPIPE, and its default action ends the process. iOS writes no .ips for it.

Rust binaries never see this, because Rust's startup sets SIGPIPE to SIG_IGN before main. 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() sets SIGPIPE to SIG_IGN first thing in gpui_ios_register_app and android_main. Writes to a closed socket then fail with EPIPE, which the connection code already handles as a disconnect.
  • --sigpipe-test (simulator only): writes to a Unix socket whose peer has been dropped, then prints OX Mobile survived a write to a closed socket: …. check-ios-launch.sh runs it.
  • libc becomes 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:

Run Result
Fix skipped no marker; termination reported by launchd (2, 13, 13), the same as Monday
Fix in place OX Mobile survived a write to a closed socket: Broken pipe (os error 32), then OX Mobile scene active

So 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

🤖 Generated with Claude Code

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T11:22:14.409901Z 5714b96 Draft marked ready
🔒 Security Review ✅ Completed 2026-12-03T11:24:03.250880Z 5714b96 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue 18cc302

@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

In line to merge. Commit 5714b96 is reviewed with nothing blocking; it has entered the merge queue.

@n0rpan
n0rpan removed this pull request from the merge queue due to a manual request Dec 3, 2026
@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue 5714b96

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

Asked for by the maintainer’s queue request, for commit 5714b96.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 5714b96ceb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@n0rpan
n0rpan marked this pull request as draft December 3, 2026 11:21
@n0rpan
n0rpan marked this pull request as ready for review December 3, 2026 11:21
@n0rpan
n0rpan added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 7f33f06 Dec 3, 2026
36 checks passed
@n0rpan
n0rpan deleted the fix/mobile-ignore-sigpipe branch December 3, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant