Skip to content

perf(mobile): lower StopClient join timeout from 3s to 1s and log slow shutdown - #20

Merged
Hidden-Node merged 1 commit into
mainfrom
advisor/007-stopclient-timeout
Jul 20, 2026
Merged

perf(mobile): lower StopClient join timeout from 3s to 1s and log slow shutdown#20
Hidden-Node merged 1 commit into
mainfrom
advisor/007-stopclient-timeout

Conversation

@Hidden-Node

Copy link
Copy Markdown
Owner

When the user taps Disconnect, GooseRelayVpnService.stopVpn() waits up to 5 seconds (stopThread.join(5000L)) for Go's StopClient() to return. Inside StopClient(), after the carrier cancel() and SOCKS listener close, it waits another up to 3 seconds on <-clientDone. The inner 3s timeout is redundant with the outer 5s join.

On a healthy disconnect where the carrier shuts down in <200ms (the common case), the user still sees ~3s of "DISCONNECTING" + 500ms fade ≈ 3.5s, where the inner 3s timeout is the sole contributor — the outer 5s never kicks in.

Change: Lower the inner <-clientDone wait from 3s → 1s. If the carrier takes longer than 1s, log it and return — the outer 5s join still caps total disconnect at a sane value. Healthy disconnect drops from ~3.5s → ~1.5s with no behavioral regression.

The new [client] carrier shutdown exceeded 1s log line surfaces slow shutdowns for debugging without changing StopClient's gomobile API surface (which would ripple to Kotlin callers).

Files changed

  • mobile/mobile.go — single block replacement (+9/-1)

CI gates to watch

  • go vet (Linux — syscall.Dup resolves; the Windows-only vet error in dupFd is pre-existing, unrelated)
  • AAR build (bash ./android/build_go_mobile.sh)
  • ./gradlew :app:assembleDebug

@Hidden-Node
Hidden-Node merged commit 338e5da into main Jul 20, 2026
1 check passed
@Hidden-Node
Hidden-Node deleted the advisor/007-stopclient-timeout branch July 20, 2026 09:00
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