Skip to content

[vendored] RRServer.h public surface silently swallows startServing/stopServing failures #1183

Description

@dariusta

Source

Filed from a downstream consumer (Straton-Labs-LLC/stratton-internal, vendoring WebDriverAgentLib.xcframework).
Tracking ID in our audit: ocr-prelim-03865.

Affected file

WebDriverAgentLib/RodmanRunnerLib/RRServer.h (vendored header at native/runner/Frameworks/WebDriverAgentLib.xcframework/ios-arm64/RodmanRunnerLib.framework/Headers/RRServer.h)

Current declaration

/**
 Starts WebDriverAgent service by booting HTTP and USB server
 */
- (void)startServing;

/**
 Stops WebDriverAgent service, shutting down HTTP and USB servers.
 */
- (void)stopServing;

Defect

Both startServing and stopServing return void and have no NSError ** / BOOL return channel, no completion handler, and no documented "delegate will be notified on failure" contract on RRServerDelegate. The only declared delegate method, webServerDidRequestShutdown:, models a successful shutdown request, not a failure.

From a downstream integrator's perspective:

  1. If the HTTP listener cannot bind (EADDRINUSE, port already in use by another WDA, simulator not booted, USB mux allocation fails) the failure is invisible to the caller. The downstream UI test host just hangs and the runner's bridge handler eventually times out at the HTTP layer, with no link back to the actual cause.
  2. If stopServing partially succeeds (e.g., HTTP server tears down but the USB mux endpoint does not), the caller has no way to know a resource is still held. On iOS this leaks ideviceusbmuxd connections across test runs and produces "device busy" failures on the next session.

The header doc-comments do not say "returns silently on failure" or "check RRServerDelegate for errors" — they describe intent only.

Suggested fix

Pick one (or both) and document it on the header:

  • (preferred) Return BOOL and add an NSError **error parameter:
    - (BOOL)startServingWithError:(NSError **)error;
    - (BOOL)stopServingWithError:(NSError **)error;
    Keep the existing void entry points as thin wrappers for backward compatibility that synthesize an error log line.
  • Add RRServerDelegate methods:
    - (void)webServer:(RRServer *)webServer didFailToStartWithError:(NSError *)error;
    - (void)webServer:(RRServer *)webServer didFailToStopWithError:(NSError *)error;

Either change should be paired with explicit NSError domain constants (RRServerErrorDomain) so downstream consumers can branch on the cause.

Why this matters downstream

We patch the vendored copy only as a stop-gap; the framework will be re-vendored from upstream and any local patches will be overwritten. The right fix lives at appium/WebDriverAgent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions