Skip to content

Handle unchecked I/O failures in connectivity validation - #935

Open
kasnder wants to merge 1 commit into
masterfrom
codex/fix-validation-probe-932
Open

Handle unchecked I/O failures in connectivity validation#935
kasnder wants to merge 1 commit into
masterfrom
codex/fix-validation-probe-932

Conversation

@kasnder

@kasnder kasnder commented Sep 8, 2026

Copy link
Copy Markdown
Member

The connectivity probe catches IOException, but Android's socket factory can throw UncheckedIOException when duplicating a descriptor fails with EMFILE. That bypasses the normal failure backoff even though the current executor captures the exception.

Extract the socket operation into a small helper that converts unchecked I/O failures to IOException, preserving the complete exception chain. The existing probe failure handler then applies its normal backoff. Keep the network-bound socket factory, port 443 and 10-second connect timeout; use try-with-resources for returned sockets. Unrelated runtime exceptions still propagate.

Validation: 11 focused tests passed (NetworkValidationProbeTest and ServiceSinkholeValidationBackoffTest), covering checked and unchecked allocation/connect failures, socket cleanup, endpoint/timeout and existing backoff. Tests use a numeric address and fake sockets without network access. :app:lintGithubDebug passed with no errors; git diff --check passed.

Related to #932. This fixes probe failure handling, not the unidentified cause of long-uptime descriptor exhaustion. Current Android 16 source already closes a factory socket if binding fails, so this PR makes no factory-leak claim. No device exhaustion reproduction; keep the issue open for that investigation.

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