Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancelling a TaskGroup in which a task is starting all also cancel the TaskGroup in which it is due to run #685

Closed
2 tasks done
arthur-tacca opened this issue Feb 7, 2024 · 4 comments · Fixed by #717
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@arthur-tacca
Copy link

Things to check first

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

AnyIO version

4.2

Python version

3.10.13

What happened?

This is related to, but slightly different from, issue #517

Consider this sequence of steps with anyio (asyncio backend) in this way:

  1. I start an outer TaskGroup
  2. Within that, I start an inner TaskGroup
  3. I start a task in the inner TaskGroup, due to run in the outer TaskGroup (e.g., calling await outer_tg.start(foo) in the context of the inner TaskGroup)
  4. Before the routine calls task_status.started() and gets reparented to the outer TaskGroup, cancel the inner task group (and therefore this partially started task).

If you do all that, then the outer TaskGroup will be cancelled as well, including any other tasks that were running in it. Somehow the partially started task has leaked the cancellation from one TaskGroup to the other.

How can we reproduce the bug?

One example of how this would look:

async def issue_demo1():
    async with anyio.create_task_group() as run_tg:
        run_tg.start_soon(sleep_only)
        async with anyio.create_task_group() as start_tg:
            start_tg.start_soon(run_tg.start, sleep_twice)
            start_tg.cancel_scope.cancel()

If using TaskGroup.start_soon() on TaskGroup.start() looks a bit suspicious, another way would be to do cancellation in the background, for example with a time out:

async def issue_demo2():
    async with anyio.create_task_group() as run_tg:
        run_tg.start_soon(sleep_only)
        async with anyio.create_task_group() as start_tg:
            start_tg.cancel_scope.deadline = anyio.current_time() + 0.5
            await run_tg.start(sleep_twice)

Here are definitions of the coroutines used in the examples:

async def sleep_twice(task_status=anyio.TASK_STATUS_IGNORED):
    try:
        print("sleep_twice(): at beginning")
        await anyio.sleep(1)
        task_status.started()
        print("sleep_twice(): started() called")
        await anyio.sleep(1)
        print("sleep_twice(): completed")
    except BaseException as be:
        print(f"sleep_twice(): got exception {be!r}")
        raise

async def sleep_only():
    try:
        print("sleep_only(): at beginning")
        await anyio.sleep(100)
        print("sleep_only(): completed")
    except BaseException as be:
        print(f"sleep_only(): got exception {be!r}")
        raise

Here is an example output:

sleep_only(): at beginning
sleep_twice(): at beginning
sleep_twice(): got exception CancelledError()
sleep_only(): got exception CancelledError('Cancelled by cancel scope 27ba061c850')
@arthur-tacca arthur-tacca added the bug Something isn't working label Feb 7, 2024
@arthur-tacca
Copy link
Author

I suspect the real lesson here is that nobody is using TaskGroup.start() in this way, which is why I'm the only person reporting cancellation issues with it. (Even I don't use it in this way, I've just been testing it for completeness.) Usually, you would call await tg.start(foo) on the immediately enclosing TaskGroup, so the task start and the task main run would be in the same one. So feel free to close or ignore this; I'm just posting it in case of interest.

@agronholm
Copy link
Owner

#710 contains a simpler repro of the same issue. The gist of the problem is that when an inner cancel scope cancels the start() call, then the task_done() callback of the newly created task sees that it received an exception, and cancels the task's cancel scope – which at that point is now the outer scope.

@agronholm
Copy link
Owner

The simplest test I could come up with is this:

async def test_cancel_escape_nested_scope() -> None:
    async def in_task_group(task_status: TaskStatus[None]) -> None:
        await sleep_forever()

    async with create_task_group() as tg:
        with CancelScope() as inner_scope:
            inner_scope.cancel()
            await tg.start(in_task_group)

    assert not tg.cancel_scope.cancel_called

@agronholm
Copy link
Owner

I think this is what Trio's "eventual nursery" internal concept has to do with. AnyIO needs something similar.

agronholm added a commit that referenced this issue Apr 14, 2024
This change fixes the problem by special casing the situation where the Future backing `task_status` was cancelled which only happens when the host task is cancelled.

Fixes #685. Fixes #701.
agronholm added a commit that referenced this issue Apr 14, 2024
This change fixes the problem by special casing the situation where the Future backing `task_status` was cancelled which only happens when the host task is cancelled.

Fixes #685. Fixes #710.
agronholm added a commit that referenced this issue Apr 14, 2024
This change fixes the problem by special casing the situation where the Future backing `task_status` was cancelled which only happens when the host task is cancelled.

Fixes #685. Fixes #710.
mkjpryor pushed a commit to azimuth-cloud/cluster-api-addon-provider that referenced this issue May 28, 2024
Bumps [anyio](https://github.com/agronholm/anyio) from 4.3.0 to 4.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/releases">anyio's
releases</a>.</em></p>
<blockquote>
<h2>4.4.0</h2>
<ul>
<li>Added the <code>BlockingPortalProvider</code> class to aid with
constructing synchronous counterparts to asynchronous interfaces that
would otherwise require multiple blocking portals</li>
<li>Added <code>__slots__</code> to <code>AsyncResource</code> so that
child classes can use <code>__slots__</code> (<a
href="https://redirect.github.com/agronholm/anyio/pull/733">#733</a>; PR
by Justin Su)</li>
<li>Added the <code>TaskInfo.has_pending_cancellation()</code>
method</li>
<li>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code> when cancelling a task in a TaskGroup created
with the <code>start()</code> method before the first checkpoint is
reached after calling <code>task_status.started()</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/706">#706</a>;
PR by Dominik Schwabe)</li>
<li>Fixed two bugs with <code>TaskGroup.start()</code> on asyncio:
<ul>
<li>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code> when cancelling a task in a TaskGroup created
with the <code>start()</code> method before the first checkpoint is
reached after calling <code>task_status.started()</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/706">#706</a>;
PR by Dominik Schwabe)</li>
<li>Fixed the entire task group being cancelled if a
<code>TaskGroup.start()</code> call gets cancelled (<a
href="https://redirect.github.com/agronholm/anyio/issues/685">#685</a>,
<a
href="https://redirect.github.com/agronholm/anyio/issues/710">#710</a>)</li>
</ul>
</li>
<li>Fixed a race condition that caused crashes when multiple event loops
of the same backend were running in separate threads and simultaneously
attempted to use AnyIO for their first time (<a
href="https://redirect.github.com/agronholm/anyio/issues/425">#425</a>;
PR by David Jiricek and Ganden Schaffner)</li>
<li>Fixed cancellation delivery on asyncio incrementing the wrong cancel
scope's cancellation counter when cascading a cancel operation to a
child scope, thus failing to uncancel the host task (<a
href="https://redirect.github.com/agronholm/anyio/issues/716">#716</a>)</li>
<li>Fixed erroneous <code>TypedAttributeLookupError</code> if a typed
attribute getter raises <code>KeyError</code></li>
<li>Fixed the asyncio backend not respecting the
<code>PYTHONASYNCIODEBUG</code> environment variable when setting the
<code>debug</code> flag in <code>anyio.run()</code></li>
<li>Fixed <code>SocketStream.receive()</code> not detecting EOF on
asyncio if there is also data in the read buffer (<a
href="https://redirect.github.com/agronholm/anyio/issues/701">#701</a>)</li>
<li>Fixed <code>MemoryObjectStream</code> dropping an item if the item
is delivered to a recipient that is waiting to receive an item but has a
cancellation pending (<a
href="https://redirect.github.com/agronholm/anyio/issues/728">#728</a>)</li>
<li>Emit a <code>ResourceWarning</code> for
<code>MemoryObjectReceiveStream</code> and
<code>MemoryObjectSendStream</code> that were garbage collected without
being closed (PR by Andrey Kazantcev)</li>
<li>Fixed <code>MemoryObjectSendStream.send()</code> not raising
<code>BrokenResourceError</code> when the last corresponding
<code>MemoryObjectReceiveStream</code> is closed while waiting to send a
falsey item (<a
href="https://redirect.github.com/agronholm/anyio/issues/731">#731</a>;
PR by Ganden Schaffner)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst">anyio's
changelog</a>.</em></p>
<blockquote>
<h1>Version history</h1>
<p>This library adheres to <code>Semantic Versioning 2.0
&lt;http://semver.org/&gt;</code>_.</p>
<p><strong>4.4.0</strong></p>
<ul>
<li>
<p>Added the <code>BlockingPortalProvider</code> class to aid with
constructing synchronous
counterparts to asynchronous interfaces that would otherwise require
multiple blocking
portals</p>
</li>
<li>
<p>Added <code>__slots__</code> to <code>AsyncResource</code> so that
child classes can use <code>__slots__</code>
(<code>[#733](agronholm/anyio#733)
&lt;https://github.com/agronholm/anyio/pull/733&gt;</code>_; PR by
Justin Su)</p>
</li>
<li>
<p>Added the <code>TaskInfo.has_pending_cancellation()</code> method</p>
</li>
<li>
<p>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code>
when cancelling a task in a TaskGroup created with the
<code>start()</code> method before
the first checkpoint is reached after calling
<code>task_status.started()</code>
(<code>[#706](agronholm/anyio#706)
&lt;https://github.com/agronholm/anyio/issues/706&gt;</code>_; PR by
Dominik Schwabe)</p>
</li>
<li>
<p>Fixed two bugs with <code>TaskGroup.start()</code> on asyncio:</p>
<ul>
<li>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code>
when cancelling a task in a TaskGroup created with the
<code>start()</code> method before
the first checkpoint is reached after calling
<code>task_status.started()</code>
(<code>[#706](agronholm/anyio#706)
&lt;https://github.com/agronholm/anyio/issues/706&gt;</code>_; PR by
Dominik Schwabe)</li>
<li>Fixed the entire task group being cancelled if a
<code>TaskGroup.start()</code> call gets
cancelled (<code>[#685](agronholm/anyio#685)
&lt;https://github.com/agronholm/anyio/issues/685&gt;</code><em>,
<code>[#710](agronholm/anyio#710)
&lt;https://github.com/agronholm/anyio/issues/710&gt;</code></em>)</li>
</ul>
</li>
<li>
<p>Fixed a race condition that caused crashes when multiple event loops
of the same
backend were running in separate threads and simultaneously attempted to
use AnyIO for
their first time
(<code>[#425](agronholm/anyio#425)
&lt;https://github.com/agronholm/anyio/issues/425&gt;</code>_; PR by
David
Jiricek and Ganden Schaffner)</p>
</li>
<li>
<p>Fixed cancellation delivery on asyncio incrementing the wrong cancel
scope's
cancellation counter when cascading a cancel operation to a child scope,
thus failing
to uncancel the host task
(<code>[#716](agronholm/anyio#716)
&lt;https://github.com/agronholm/anyio/issues/716&gt;</code>_)</p>
</li>
<li>
<p>Fixed erroneous <code>TypedAttributeLookupError</code> if a typed
attribute getter raises
<code>KeyError</code></p>
</li>
<li>
<p>Fixed the asyncio backend not respecting the
<code>PYTHONASYNCIODEBUG</code> environment
variable when setting the <code>debug</code> flag in
<code>anyio.run()</code></p>
</li>
<li>
<p>Fixed <code>SocketStream.receive()</code> not detecting EOF on
asyncio if there is also data in
the read buffer
(<code>[#701](agronholm/anyio#701)
&lt;https://github.com/agronholm/anyio/issues/701&gt;</code>_)</p>
</li>
<li>
<p>Fixed <code>MemoryObjectStream</code> dropping an item if the item is
delivered to a recipient
that is waiting to receive an item but has a cancellation pending
(<code>[#728](agronholm/anyio#728)
&lt;https://github.com/agronholm/anyio/issues/728&gt;</code>_)</p>
</li>
<li>
<p>Emit a <code>ResourceWarning</code> for
<code>MemoryObjectReceiveStream</code> and
<code>MemoryObjectSendStream</code> that were garbage collected without
being closed (PR by
Andrey Kazantcev)</p>
</li>
<li>
<p>Fixed <code>MemoryObjectSendStream.send()</code> not raising
<code>BrokenResourceError</code> when the
last corresponding <code>MemoryObjectReceiveStream</code> is closed
while waiting to send a
falsey item (<code>[#731](agronholm/anyio#731)
&lt;https://github.com/agronholm/anyio/issues/731&gt;</code>_; PR by
Ganden
Schaffner)</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/agronholm/anyio/commit/053e8f0a0f7b0f4a47a012eb5c6b1d9d84344e6a"><code>053e8f0</code></a>
Bumped up the version</li>
<li><a
href="https://github.com/agronholm/anyio/commit/e7f750b96f5416d8ae932e15d726b5d03de80b67"><code>e7f750b</code></a>
Fixed memory object stream sometimes dropping sent items (<a
href="https://redirect.github.com/agronholm/anyio/issues/735">#735</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/9f5f14b3eb57f6965fc2c16879df93263bb020ea"><code>9f5f14b</code></a>
Fixed task group getting cancelled if start() gets cancelled (<a
href="https://redirect.github.com/agronholm/anyio/issues/717">#717</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/8b648bc213a85613b9441913b82a14d9cd839048"><code>8b648bc</code></a>
Adjusted the pull request template</li>
<li><a
href="https://github.com/agronholm/anyio/commit/3ff5e9a6f1813152a7cc9ff27a8394a51812a040"><code>3ff5e9a</code></a>
Rearranged changelog items</li>
<li><a
href="https://github.com/agronholm/anyio/commit/541d1f8197dfa36076f93b39e73ee5ad06012469"><code>541d1f8</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/agronholm/anyio/issues/734">#734</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/8a076900333b6b333f1748dd8d1e8ae8079a2924"><code>8a07690</code></a>
Fix <code>MemoryObjectSendStream.send(falsey)</code> not raising
<code>BrokenResourceError</code> w...</li>
<li><a
href="https://github.com/agronholm/anyio/commit/4b3de9737672df67b691f38543427e4869639f45"><code>4b3de97</code></a>
Adjust the headings in the PR template</li>
<li><a
href="https://github.com/agronholm/anyio/commit/dfc44cf3c8c5444713258d0f1fda03e425240054"><code>dfc44cf</code></a>
Added <code>__slots__</code> to <code>AsyncResource</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/733">#733</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/96920b054c4d0c76ad440f36d7173ab5d5c86948"><code>96920b0</code></a>
Fix typo in PR template (<a
href="https://redirect.github.com/agronholm/anyio/issues/730">#730</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/agronholm/anyio/compare/4.3.0...4.4.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=anyio&package-manager=pip&previous-version=4.3.0&new-version=4.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mkjpryor pushed a commit to azimuth-cloud/azimuth that referenced this issue May 28, 2024
Bumps [anyio](https://github.com/agronholm/anyio) from 4.3.0 to 4.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/releases">anyio's
releases</a>.</em></p>
<blockquote>
<h2>4.4.0</h2>
<ul>
<li>Added the <code>BlockingPortalProvider</code> class to aid with
constructing synchronous counterparts to asynchronous interfaces that
would otherwise require multiple blocking portals</li>
<li>Added <code>__slots__</code> to <code>AsyncResource</code> so that
child classes can use <code>__slots__</code> (<a
href="https://redirect.github.com/agronholm/anyio/pull/733">#733</a>; PR
by Justin Su)</li>
<li>Added the <code>TaskInfo.has_pending_cancellation()</code>
method</li>
<li>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code> when cancelling a task in a TaskGroup created
with the <code>start()</code> method before the first checkpoint is
reached after calling <code>task_status.started()</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/706">#706</a>;
PR by Dominik Schwabe)</li>
<li>Fixed two bugs with <code>TaskGroup.start()</code> on asyncio:
<ul>
<li>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code> when cancelling a task in a TaskGroup created
with the <code>start()</code> method before the first checkpoint is
reached after calling <code>task_status.started()</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/706">#706</a>;
PR by Dominik Schwabe)</li>
<li>Fixed the entire task group being cancelled if a
<code>TaskGroup.start()</code> call gets cancelled (<a
href="https://redirect.github.com/agronholm/anyio/issues/685">#685</a>,
<a
href="https://redirect.github.com/agronholm/anyio/issues/710">#710</a>)</li>
</ul>
</li>
<li>Fixed a race condition that caused crashes when multiple event loops
of the same backend were running in separate threads and simultaneously
attempted to use AnyIO for their first time (<a
href="https://redirect.github.com/agronholm/anyio/issues/425">#425</a>;
PR by David Jiricek and Ganden Schaffner)</li>
<li>Fixed cancellation delivery on asyncio incrementing the wrong cancel
scope's cancellation counter when cascading a cancel operation to a
child scope, thus failing to uncancel the host task (<a
href="https://redirect.github.com/agronholm/anyio/issues/716">#716</a>)</li>
<li>Fixed erroneous <code>TypedAttributeLookupError</code> if a typed
attribute getter raises <code>KeyError</code></li>
<li>Fixed the asyncio backend not respecting the
<code>PYTHONASYNCIODEBUG</code> environment variable when setting the
<code>debug</code> flag in <code>anyio.run()</code></li>
<li>Fixed <code>SocketStream.receive()</code> not detecting EOF on
asyncio if there is also data in the read buffer (<a
href="https://redirect.github.com/agronholm/anyio/issues/701">#701</a>)</li>
<li>Fixed <code>MemoryObjectStream</code> dropping an item if the item
is delivered to a recipient that is waiting to receive an item but has a
cancellation pending (<a
href="https://redirect.github.com/agronholm/anyio/issues/728">#728</a>)</li>
<li>Emit a <code>ResourceWarning</code> for
<code>MemoryObjectReceiveStream</code> and
<code>MemoryObjectSendStream</code> that were garbage collected without
being closed (PR by Andrey Kazantcev)</li>
<li>Fixed <code>MemoryObjectSendStream.send()</code> not raising
<code>BrokenResourceError</code> when the last corresponding
<code>MemoryObjectReceiveStream</code> is closed while waiting to send a
falsey item (<a
href="https://redirect.github.com/agronholm/anyio/issues/731">#731</a>;
PR by Ganden Schaffner)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst">anyio's
changelog</a>.</em></p>
<blockquote>
<h1>Version history</h1>
<p>This library adheres to <code>Semantic Versioning 2.0
&lt;http://semver.org/&gt;</code>_.</p>
<p><strong>4.4.0</strong></p>
<ul>
<li>
<p>Added the <code>BlockingPortalProvider</code> class to aid with
constructing synchronous
counterparts to asynchronous interfaces that would otherwise require
multiple blocking
portals</p>
</li>
<li>
<p>Added <code>__slots__</code> to <code>AsyncResource</code> so that
child classes can use <code>__slots__</code>
(<code>[#733](agronholm/anyio#733)
&lt;https://github.com/agronholm/anyio/pull/733&gt;</code>_; PR by
Justin Su)</p>
</li>
<li>
<p>Added the <code>TaskInfo.has_pending_cancellation()</code> method</p>
</li>
<li>
<p>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code>
when cancelling a task in a TaskGroup created with the
<code>start()</code> method before
the first checkpoint is reached after calling
<code>task_status.started()</code>
(<code>[#706](agronholm/anyio#706)
&lt;https://github.com/agronholm/anyio/issues/706&gt;</code>_; PR by
Dominik Schwabe)</p>
</li>
<li>
<p>Fixed two bugs with <code>TaskGroup.start()</code> on asyncio:</p>
<ul>
<li>Fixed erroneous <code>RuntimeError: called 'started' twice on the
same task status</code>
when cancelling a task in a TaskGroup created with the
<code>start()</code> method before
the first checkpoint is reached after calling
<code>task_status.started()</code>
(<code>[#706](agronholm/anyio#706)
&lt;https://github.com/agronholm/anyio/issues/706&gt;</code>_; PR by
Dominik Schwabe)</li>
<li>Fixed the entire task group being cancelled if a
<code>TaskGroup.start()</code> call gets
cancelled (<code>[#685](agronholm/anyio#685)
&lt;https://github.com/agronholm/anyio/issues/685&gt;</code><em>,
<code>[#710](agronholm/anyio#710)
&lt;https://github.com/agronholm/anyio/issues/710&gt;</code></em>)</li>
</ul>
</li>
<li>
<p>Fixed a race condition that caused crashes when multiple event loops
of the same
backend were running in separate threads and simultaneously attempted to
use AnyIO for
their first time
(<code>[#425](agronholm/anyio#425)
&lt;https://github.com/agronholm/anyio/issues/425&gt;</code>_; PR by
David
Jiricek and Ganden Schaffner)</p>
</li>
<li>
<p>Fixed cancellation delivery on asyncio incrementing the wrong cancel
scope's
cancellation counter when cascading a cancel operation to a child scope,
thus failing
to uncancel the host task
(<code>[#716](agronholm/anyio#716)
&lt;https://github.com/agronholm/anyio/issues/716&gt;</code>_)</p>
</li>
<li>
<p>Fixed erroneous <code>TypedAttributeLookupError</code> if a typed
attribute getter raises
<code>KeyError</code></p>
</li>
<li>
<p>Fixed the asyncio backend not respecting the
<code>PYTHONASYNCIODEBUG</code> environment
variable when setting the <code>debug</code> flag in
<code>anyio.run()</code></p>
</li>
<li>
<p>Fixed <code>SocketStream.receive()</code> not detecting EOF on
asyncio if there is also data in
the read buffer
(<code>[#701](agronholm/anyio#701)
&lt;https://github.com/agronholm/anyio/issues/701&gt;</code>_)</p>
</li>
<li>
<p>Fixed <code>MemoryObjectStream</code> dropping an item if the item is
delivered to a recipient
that is waiting to receive an item but has a cancellation pending
(<code>[#728](agronholm/anyio#728)
&lt;https://github.com/agronholm/anyio/issues/728&gt;</code>_)</p>
</li>
<li>
<p>Emit a <code>ResourceWarning</code> for
<code>MemoryObjectReceiveStream</code> and
<code>MemoryObjectSendStream</code> that were garbage collected without
being closed (PR by
Andrey Kazantcev)</p>
</li>
<li>
<p>Fixed <code>MemoryObjectSendStream.send()</code> not raising
<code>BrokenResourceError</code> when the
last corresponding <code>MemoryObjectReceiveStream</code> is closed
while waiting to send a
falsey item (<code>[#731](agronholm/anyio#731)
&lt;https://github.com/agronholm/anyio/issues/731&gt;</code>_; PR by
Ganden
Schaffner)</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/agronholm/anyio/commit/053e8f0a0f7b0f4a47a012eb5c6b1d9d84344e6a"><code>053e8f0</code></a>
Bumped up the version</li>
<li><a
href="https://github.com/agronholm/anyio/commit/e7f750b96f5416d8ae932e15d726b5d03de80b67"><code>e7f750b</code></a>
Fixed memory object stream sometimes dropping sent items (<a
href="https://redirect.github.com/agronholm/anyio/issues/735">#735</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/9f5f14b3eb57f6965fc2c16879df93263bb020ea"><code>9f5f14b</code></a>
Fixed task group getting cancelled if start() gets cancelled (<a
href="https://redirect.github.com/agronholm/anyio/issues/717">#717</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/8b648bc213a85613b9441913b82a14d9cd839048"><code>8b648bc</code></a>
Adjusted the pull request template</li>
<li><a
href="https://github.com/agronholm/anyio/commit/3ff5e9a6f1813152a7cc9ff27a8394a51812a040"><code>3ff5e9a</code></a>
Rearranged changelog items</li>
<li><a
href="https://github.com/agronholm/anyio/commit/541d1f8197dfa36076f93b39e73ee5ad06012469"><code>541d1f8</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/agronholm/anyio/issues/734">#734</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/8a076900333b6b333f1748dd8d1e8ae8079a2924"><code>8a07690</code></a>
Fix <code>MemoryObjectSendStream.send(falsey)</code> not raising
<code>BrokenResourceError</code> w...</li>
<li><a
href="https://github.com/agronholm/anyio/commit/4b3de9737672df67b691f38543427e4869639f45"><code>4b3de97</code></a>
Adjust the headings in the PR template</li>
<li><a
href="https://github.com/agronholm/anyio/commit/dfc44cf3c8c5444713258d0f1fda03e425240054"><code>dfc44cf</code></a>
Added <code>__slots__</code> to <code>AsyncResource</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/733">#733</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/96920b054c4d0c76ad440f36d7173ab5d5c86948"><code>96920b0</code></a>
Fix typo in PR template (<a
href="https://redirect.github.com/agronholm/anyio/issues/730">#730</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/agronholm/anyio/compare/4.3.0...4.4.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=anyio&package-manager=pip&previous-version=4.3.0&new-version=4.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants