Skip to content

fix(remote): repair startup deadlock, idle cleanup, and android adb:// crash#238

Merged
BANANASJIM merged 3 commits into
masterfrom
fix/remote-lifecycle
Jun 10, 2026
Merged

fix(remote): repair startup deadlock, idle cleanup, and android adb:// crash#238
BANANASJIM merged 3 commits into
masterfrom
fix/remote-lifecycle

Conversation

@BANANASJIM

Copy link
Copy Markdown
Owner

Three pre-existing remote-replay robustness bugs (surfaced while testing remote texture export). Independent of the export feature; isolated here per one-fix-per-PR.

1. Startup deadlock (HIGH)

rdc open --proxy / split / android hung and failed with "daemon failed to start (uploading: 0%)" for any real capture. The daemon is spawned with stderr=PIPE (since #47) but the startup wait loop (wait_for_ping) never drains it; RenderDoc's verbose upload logging fills the ~64KB pipe buffer and the daemon blocks on write() before serving its first ping.

Fix: redirect daemon stderr to a temp file (no buffer limit; tail is read on failure to preserve the error hint from #47). Regression test floods >150KB to a child's stderr and asserts open_session returns without hanging.

2. Idle-timeout leak (MEDIUM)

When the daemon exits via idle-timeout it skipped the remote CloseCapture / ShutdownConnection that the shutdown RPC performs, leaking the replay session on the remoteserver. Extracted a shared cleanup_state() invoked by both the shutdown path and the idle-timeout exit.

3. Android adb:// crash (HIGH)

_resolve_android_url fell back to returning adb://SERIAL when no adb forward was found; passing an adb:// URL to the daemon crashes it. Now raises a clear UsageError pointing to rdc android setup --serial SERIAL.

Testing

Unit tests added for each (including the deadlock flooding-child regression and the cleanup_state remote-teardown assertions). ruff + mypy clean. The deadlock fix was additionally verified end-to-end: rdc open --proxy now completes instead of hanging.

_resolve_android_url fell back to returning an adb://SERIAL URL when no
adb forward existed; passing that URL to the daemon crashes it. Raise a
clear UsageError pointing at 'rdc android setup --serial' instead, and
update tests to mock the forwarded-port lookup.
The idle-timeout exit path in run_server skipped the remote
CloseCapture/ShutdownConnection that _handle_shutdown performs, leaking
the remote replay session on the remoteserver. Extract the teardown into
a shared cleanup_state() helper and call it from both _handle_shutdown
and the idle-timeout exit.
… regression)

start_daemon spawned the daemon with stderr=PIPE but wait_for_ping never
drained it; during remote replay the daemon's verbose upload logging
filled the ~64KB pipe and blocked before serving its first ping, so open
failed with a startup timeout. Redirect daemon stderr to a temp file
(no buffer limit) and read its tail on failure, applied to both
open_session and listen_open_session. Adds a regression test spawning a
child that floods >128KB to stderr then sleeps, asserting startup does
not hang.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@BANANASJIM, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 14 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21c6b527-c369-4359-b42c-d8f77d6a7142

📥 Commits

Reviewing files that changed from the base of the PR and between 4576962 and 944a73b.

📒 Files selected for processing (9)
  • src/rdc/commands/session.py
  • src/rdc/daemon_server.py
  • src/rdc/handlers/core.py
  • src/rdc/services/session_service.py
  • tests/unit/test_handlers_remote.py
  • tests/unit/test_quickfix_batch.py
  • tests/unit/test_session_commands.py
  • tests/unit/test_session_service.py
  • tests/unit/test_split_core.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remote-lifecycle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@BANANASJIM BANANASJIM merged commit 8abc531 into master Jun 10, 2026
17 checks passed
@BANANASJIM BANANASJIM deleted the fix/remote-lifecycle branch June 10, 2026 03:48
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