Skip to content

manager: close module update HTTP responses - #1636

Open
fhgffy wants to merge 1 commit into
bmax121:mainfrom
fhgffy:fix/module-update-response-cleanup
Open

fhgffy wants to merge 1 commit into
bmax121:mainfrom
fhgffy:fix/module-update-response-cleanup

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 6, 2026

Copy link
Copy Markdown

checkUpdate() only consumes the response body for a successful HTTP status. A non-2xx response returns an empty string without closing the response, leaving its connection or cached body open after the update check finishes.

Wrap the response in use, matching the existing HTTP cleanup pattern elsewhere in the Manager. The current logging, parsing and no-update fallback stay unchanged.

Reproduction and checks:

  • Compiled the complete production APModuleViewModel.kt with Kotlin 2.4.10 and Java 21 in an external JVM harness, using real OkHttp 5.5.0, a loopback HTTP server and a real disk cache
  • On the base, 404/500 and cached-404 response sources stayed open; six sequential 404 requests retained six non-idle pooled connections before cleanup
  • The focused suite goes from 8/12 to 12/12 passing, covering successful metadata, invalid/no-newer metadata, HTTP errors, body-read failure, repeated requests and cache hits
  • A separate review reproduced the results and checked connection failure, an exception after response acquisition, empty error responses and a redirect to an error response
  • git diff --check passes

The harness uses boundary stubs for Android/Compose/lifecycle and app initialization, and JSON-Java in place of Android's JSON implementation. It is an external reproduction, not a committed Android test target. Full Gradle/Android build, lint, emulator/device and instrumentation checks have not been run. This change is limited to response cleanup in the Manager.

@fhgffy
fhgffy marked this pull request as ready for review October 6, 2026 12:58
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