Skip to content

fix(ios): stop dump ui from timing out after 10s on heavy screens - #497

Open
Cassian433 wants to merge 1 commit into
mobile-next:mainfrom
Cassian433:fix-ios-dump-ui-timeout
Open

Cassian433 wants to merge 1 commit into
mobile-next:mainfrom
Cassian433:fix-ios-dump-ui-timeout

Conversation

@Cassian433

@Cassian433 Cassian433 commented Oct 5, 2026 •

Copy link
Copy Markdown

On a big screen, device.dump.ui on iOS gives up after 10 seconds with RPC call device.dump.ui failed: Post "http://localhost:<port>/rpc": context deadline exceeded while the agent is still building the snapshot. #448 hits it on a React Native SectionList, and a comment on mobile-mcp #470 reports the same failure under load.

It's a regression. #131 gave the iOS dump 60s on purpose (the CHANGELOG still says so). When the agent moved to json-rpc in #196 (f41f841), GetSourceRaw and GetSourceElements in devices/devicekit/source.go started going through CallRPC, so a dump got the same 10s defaultRPCTimeout as a tap. Fixing only that isn't enough over HTTP: the server's WriteTimeout is also 10s and device.dump.ui wasn't in extendedWriteDeadline, so a slow dump would come back as an EOF instead.

What changed:

  • dumpUITimeout (55s) in requests.go, used by both dump calls through CallRPCWithTimeout. 55 and not 60 for the same reason as maxPressKeysTimeout, it has to stay under the http client's own 60s.
  • device.dump.ui gets a 60s write deadline in extendedWriteDeadline. rpcTimeout reads the same table, so the daemon forward stays at 60s like today.
  • defaultRPCTimeout is now a var so the test can shrink it to 50ms instead of sleeping 10s.

No device involved in testing. The new TestDumpUIWaitsForAnAgentSlowerThanTheDefaultRPCTimeout puts an httptest fake agent in front of the client that answers every call after 200ms: a plain CallRPC has to time out, both dump calls have to succeed. On main (only the const turned into a var so it compiles) it fails with the issue's error, Post "http://127.0.0.1:43573/rpc": context deadline exceeded. On this branch it passes in 0.46s, and 20 runs in a row under -race were clean. I also ran a throwaway copy with the real timeouts and an agent that takes 11s: main gave up at 10.01s, the branch got the tree back at 11.01s. deadline_test.go lists device.dump.ui now. go test ./... -race passes on Linux, most of its 20s is the daemon package.

#470's home-screen hang on iOS 26.1 looks like its own agent problem, and this only moves that error from 10s to 55s. The intermittent dump failures after 10s in the comment there are this bug, though.

Closes #448

Summary by CodeRabbit

  • Bug Fixes
    • UI snapshots can now complete reliably when device responses take longer than the default RPC timeout.
    • The server allows up to 60 seconds for UI snapshot responses.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: mobile-next/mobilecli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cc34bff4-80bc-4370-9b6a-738ffa1d1f30
📥 Commits

Reviewing files that changed from the base of the PR and between aca77be and aece91f.

📒 Files selected for processing (5)
  • devices/devicekit/requests.go
  • devices/devicekit/source.go
  • devices/devicekit/source_test.go
  • server/deadline_test.go
  • server/server.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The client now gives device.dump.ui RPC requests a 55-second timeout. The server assigns those requests a 60-second write deadline. A regression test checks that source requests succeed when a standard device.info request exceeds the default timeout.

Changes

UI dump timeout handling

Layer / File(s) Summary
Set UI dump timeouts
devices/devicekit/requests.go, devices/devicekit/source.go, server/server.go, devices/devicekit/source_test.go, server/deadline_test.go
The client uses a 55-second timeout for raw and JSON UI dump requests. The server assigns device.dump.ui a 60-second write deadline. A regression test checks that device.info times out while GetSourceElements and GetSourceRaw succeed.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: gmegidish

Merge Risk: ⚪ Minimal · up to aece9

The UI-dump timeout extension is wired through the client and server paths; no merge-blocking issue is supported by the reviewed evidence.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing device.dump.ui from timing out after 10 seconds on heavy screens.
Linked Issues check ✅ Passed #448 reports that device.dump.ui times out while the iOS agent builds a heavy-screen snapshot. GetSourceRaw and GetSourceElements now use CallRPCWithTimeout with a 55-second dump timeout. The …
Out of Scope Changes check ✅ Passed All reported changes support #448. The defaultRPCTimeout variable enables the regression test to shorten the default timeout. The delayed-agent test verifies the timeout behavior, and the server dea…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

The 60s dump timeout from mobile-next#131 was lost when the agent moved to json-rpc in mobile-next#196.
@Cassian433
Cassian433 force-pushed the fix-ios-dump-ui-timeout branch from 2f69315 to aece91f Compare October 5, 2026 19:34
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.

device.dump.ui times out on a heavy React Native screen on iOS simulator

1 participant