Skip to content

Fix an Android crash on Connect GET and several minor bridge issues - #8

Merged
gartnera merged 2 commits into
mainfrom
claude/practical-ritchie-ltf01m
Nov 10, 2026
Merged

gartnera merged 2 commits into
mainfrom
claude/practical-ritchie-ltf01m

Conversation

@gartnera

Copy link
Copy Markdown
Member

Fixes from a correctness review of the package.

Changes

  • Android: a GET no longer crashes the app. Cronet ends a GET's or HEAD's request side with its headers. The bridge still wrote the empty end-of-request buffer, which hits a CHECK in Chromium's SpdyStream::SendData and aborts the process. Connect GET (useHttpGet) took this path on every call. The bridge now writes nothing to the request side of those methods.
  • Dart: no stray unhandled error. A failed event that arrives before the open reply failed the call correctly but was also reported as an unhandled async error.
  • Android: the bridge thread survives an Error. It caught Exception only, so an OutOfMemoryError from a buffer allocation ended the thread and the app. It now fails the one call.
  • Android: detaching cleans up. onDetachedFromEngine cancelled calls but left the Cronet engines and the bridge thread running. close() (was cancelAll()) shuts the engines down as their calls end, then stops the thread.
  • iOS: http3Origins match case-insensitively. Dart's Uri lowercases hosts and URL does not, so a base URL with an uppercase host lost its HTTP/3 hint.
  • Dart: call ids start at a random value. After a hot restart, a new call could get the id of a call the plugin still carried, and receive its events. Debug builds only.
  • Docs: Cronet's BidirectionalStream carries neither HTTP/1.1 nor http:// URLs, so Android never reports http/1.1. The README and NativeHttpConfig said it could.

Tests

  • New Dart unit test for the failure that overtakes the open reply; it fails without the fix.
  • New GET case in the Android bridge tests and in the Dart integration tests. The test server now reports the request method in X-Method so the integration test can check that a GET was sent.

Verification

  • Run locally: dart format, flutter analyze (package and example), flutter test (54 pass), go vet, go test.
  • Not run locally: the Kotlin and Swift changes and the two new device tests were not compiled or run; there was no Android SDK, emulator or Xcode available. CI on this PR is their first check.
  • The GET crash was established by reading Chromium 143 source, not reproduced on a device.

Generated by Claude Code

…gine leaks, HTTP/3 host case

- Dart: a failure event that overtakes the open reply no longer also reports an unhandled error.
- Android: the bridge thread catches Throwable, so an OutOfMemoryError fails its call instead of the app.
- Android: detaching from the Flutter engine shuts the Cronet engines and the bridge thread down.
- iOS: http3Origins match the request host case-insensitively.
- Docs: Cronet's BidirectionalStream carries neither HTTP/1.1 nor http:// URLs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqmpXVmhnobv11U2vaqWwX
…om value

- Android: no write to a GET's or HEAD's request side. Cronet ends it with the headers, and the empty write that
  ends a request then hit a CHECK in Chromium's SpdyStream::SendData, which aborts the process. Connect GET
  (useHttpGet) took this path on every call.
- Dart: call ids start at a random value, so after a hot restart a new call doesn't get the id of a call the
  plugin still carries, and with it that call's events.
- Tests: a GET in the Android bridge tests and the Dart integration tests; the test server reports the request
  method in X-Method.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqmpXVmhnobv11U2vaqWwX
@gartnera
gartnera enabled auto-merge (squash) November 10, 2026 18:29
@gartnera
gartnera merged commit 5f9f224 into main Nov 10, 2026
6 checks passed
@gartnera
gartnera deleted the claude/practical-ritchie-ltf01m branch November 10, 2026 18:38
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.

2 participants