Skip to content
New issue

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

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

Already on GitHub? # to your account

Document Structured Concurrency violating functions #727

Open
weissi opened this issue Feb 5, 2025 · 0 comments
Open

Document Structured Concurrency violating functions #727

weissi opened this issue Feb 5, 2025 · 0 comments
Labels
area/documentation Improvements or additions to documentation. kind/enhancement Improvements to existing feature.

Comments

@weissi
Copy link
Member

weissi commented Feb 5, 2025

Description

At the moment, the generator generates functions that violate Structured Concurrency, for example anything that uses HTTP response streaming. The user gets returned an async sequence that they are then supposed to stream and until that's done resources in other tasks/threads are still holding onto the live request.

This is of course violates the main principle of Structured Concurrency which is that upon return of a function, the execution resources it acquired have been released back.

Violating Structured Concurrency might be acceptable in certain cases but:

  1. It should be documented that what's going on [this bug report]
  2. An alternative should be offered (such as try await withFooRequest(parameters: Parameters) { result, responseBodyStream in ... }) [Offer Structured Concurrency conforming APIs for response streaming #728]

This bug report is squarely about (1), the documentation that certain APIs (namely anything that does HTTP response streaming) violates Structured Concurrency.

Similar efforts in other projects:

Reproduction

n/a

Package version(s)

all

Expected behavior

docs

Environment

n/a

Additional information

No response

@weissi weissi added kind/bug Feature doesn't work as expected. status/triage Collecting information required to triage the issue. semver/none No version bump required. labels Feb 5, 2025
@czechboy0 czechboy0 added area/documentation Improvements or additions to documentation. kind/enhancement Improvements to existing feature. and removed kind/bug Feature doesn't work as expected. semver/none No version bump required. status/triage Collecting information required to triage the issue. labels Feb 5, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area/documentation Improvements or additions to documentation. kind/enhancement Improvements to existing feature.
Projects
None yet
Development

No branches or pull requests

2 participants