[mime] Fix hanging part streams on source stream error or completion#2429
[mime] Fix hanging part streams on source stream error or completion#2429iv-re wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates BoundMultipartStream to properly handle errors and premature onDone events from the source stream, preventing hangs by ensuring the active multipart controller is closed and notified. It also adds comprehensive tests to verify this behavior. The reviewer identified a potential bug where a null assertion failure could occur if the source stream continues to emit data after an error, and suggested setting _state = _failCode in the onError handler to prevent further parsing.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
47b402d to
3168426
Compare
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthUnused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Changelog Entry ❗
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with |
lrhn
left a comment
There was a problem hiding this comment.
No opinion on whether this is a good change, I don't know the code well enough. Just nit-picking on style.
| _multipartController!.addError(_exceptionBadEnding); | ||
| } | ||
| _multipartController!.close(); | ||
| _multipartController = null; |
There was a problem hiding this comment.
No _tryPropagateControllerState(); here, like in line 146?
Is it not needed when _controller is being closed immediately after?
There was a problem hiding this comment.
_tryPropagateControllerState() syncs the main controller's state (pause/resume/cancel) to _subscription.
In onDone, the source stream is already finished and _subscription is dead, making any synchronization or cancellation calls on it redundant.
3168426 to
ef9deac
Compare
Fixes #2428
Propagate source stream errors and premature close events (
MimeMultipartException) to the active part stream (_multipartController) and close it. This prevents listeners of the active part from hanging indefinitely.Adds corresponding tests in
mime_multipart_transformer_test.dart.Contribution guidelines:
dart format.Many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
Note: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer.