Repository navigation
[coverage] Fix connection disposed error - #2903
liamappelbe wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request resolves a race condition in collect() during VM service connection retries by refactoring the connection logic into a dedicated _connect helper function and ensuring failed connection attempts are properly disposed. It also updates the vm_service package constraints and adds comprehensive tests in retry_connection_test.dart. The review feedback suggests removing a redundant as VmService cast since the type is already inferred, and forwarding WebSocket stream errors to the controller in _connect to prevent unhandled asynchronous errors.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
PR HealthPublish ✔️
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. 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 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 Unused Dependencies ✔️
For details on how to fix these, see dependency_validator. 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 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 |
One way the connection disposed errors seen here could happen is:
collectcloses over the mutable variableservice.dispose()call inonDoneis redundant.servicevariable with a new instance, and the first try would calldispose()on the second instance.TimeoutExceptions, which made the issue worse.So the fix is to:
service.dispose().TimeoutException.Integration test and fix based on dart-lang/sdk#64233 (comment)