-
Notifications
You must be signed in to change notification settings - Fork 4.5k
.Net: Bug: .NET Bedrock streaming completion is keeping the request thread busy #9519
Copy link
Copy link
Closed
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't working
Description
Describe the bug
The current implementation of the Bedrock connector is using response.Stream.AsEnumerable() in BedrockChatCompletionClient.cs#L193, which is keeping the current .NET thread busy while it reads the response stream. This could cause thread exhaustion issues.
To Reproduce
Steps to reproduce the behavior:
- See code at
Line 193 in f88cf5f
foreach (var chunk in response.Stream.AsEnumerable())
Expected behavior
Replace .AsEnumerable() with something that would read the response stream in an async manner.
Screenshots
N/A
Platform
- OS: all
- IDE: N/A
- Language: C#
- Source: NuGet package version 1.26.0
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't working
Type
Projects
Status
Bug