Skip to content

HTTP sync stream has no idle timeout, so a silently dead stream is never detected (Capacitor) #1208

Open

Description

@mwventures

On the HTTP connection method, the sync stream only times the connect (connectTimeoutMs; in AbstractRemote.ts on main: "The timeout ends once the response starts, so it never aborts the response body."). Once the response body is streaming, a stream that dies silently (a network change, a proxy or NAT dropping it) is never noticed: the client keeps reporting connected and receives nothing until something else makes it reconnect.

The service sends a keepalive line on an idle stream about every 20 s, so an idle timeout of about 30 s on the response body would catch this. The WebSocket transport already does this (SOCKET_TIMEOUT_MS), and so does the .NET SDK (powersync-ja/powersync-dotnet#18).

It matters most on Capacitor: @powersync/capacitor defaults native platforms to HTTP and warns against WebSocket with CapacitorSQLiteAdapter, so an app kept open in the foreground can sit on a dead stream indefinitely. Possibly related: #1077 (a stream that stays wedged after a long iOS background).

Request: an idle timeout on the HTTP stream's response body that ends the stream and reconnects after retryDelayMs, as the WebSocket path does, ideally configurable.

Versions: @powersync/web 2.6.0, @powersync/common 2.5.0, @powersync/shared-internals 1.5.0, @powersync/capacitor 0.10.0. The current main (shared-internals 1.6.0) still only times the connect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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