Repository navigation
Fix response retention after cancelling client method calls - #7065
remote-controlled-man wants to merge 2 commits into
Conversation
….1.3 On Python 3.10 asyncio.wait_for raises asyncio.TimeoutError, which is not the builtin TimeoutError, so invoke_method() timeouts skipped the descriptive message. The test now asserts the builtin type and message.
|
Thanks for your contribution @remote-controlled-man - can you please check the CLA requirement? |
|
Thanks for the Python 3.10 timeout correction and changelog update. I checked the current head The current CI merge ref ( The failing Android py3.12 job stops during Pytest then reports a fixture setup error because the Flutter process exited. This points to Android dependency/build setup rather than an assertion failure in the session cleanup tests; the log does not establish where the invalid data originated. Could someone with Actions write access rerun that Android py3.12 job once? This contributor account has read-only repository access, so I cannot rerun it. The failed job, remaining queued checks and outstanding CLA are still unresolved. |
|
Could a maintainer rerun all nine remaining failed jobs on the unchanged head
Both inspected workflow runs are at attempt 2: eight build jobs plus one Android device job remain failed. The CLA check, Python SDK unit-test jobs for Python 3.10–3.15, and the macOS integration workflow have passed on this head. I rechecked the Android log: it fails in No code changes are included in this follow-up. |
Description
Cancelled client method calls can retain response data for the lifetime of a session. For example, cancelling a task awaiting
page.get_package_info()leaves its request registered, so a later client response is stored even though no caller can consume it. The same mechanism handles methods such asScreenshot.capture(), whose responses can be much larger.There is a second cancellation window after the response has arrived but before the waiting coroutine resumes. Removing only the pending request does not release that already-stored response.
Unregister the request and discard any unconsumed response in a
finallyblock covering message sending, waiting, and result consumption. Cancellation still propagates to the caller. Successful results, client errors, timeouts, and session-close errors keep their existing behavior.Test code
From
sdk/python:uv run --group test pytest packages/flet/tests/test_session_invoke_method.pyThe tests exercise the real session request/response path, including
page.get_package_info(). They assert that response objects become collectible after cancellation both before and after response delivery, and after timeout or session closure. Both cancellation orderings failed before their corresponding fixes.Validation on macOS, Python 3.11.16:
packages/*/testsset): 1980 passed, 15 skipped, 0 failed in 31.91 seconds, including all four new regression cases.The run reports FastAPI
root_pathdeprecations, the unset pytest-asyncio fixture-scope warning, and the shallow clone'sgit describewarning. Cross-platform device tests are left to CI.Type of change
Checklist
website/sidebars.ymlfor breaking changes, removals, and deprecations, if applicable. (Not applicable.)Screenshots
Not applicable.
Additional details
AI-assisted contribution using Codex. CLA status has not yet been verified for this account. Cross-platform device tests have not been run locally.
Summary by Sourcery
Release client method call resources reliably when requests are cancelled or fail.
Bug Fixes:
Tests: