Skip to content

[cronet_http] StreamedResponse does not close after cancelling the response stream #1757

Closed
@Colton127

Description

@Colton127

In cronet_http, cancelling the stream on a StreamedResponse does not close the underlying connection.

final engine = CronetEngine.build(cacheMode: CacheMode.disabled);
final client = CronetClient.fromCronetEngine(engine, closeEngine: true);
final request = Request('GET', Uri.parse('https://cachefly.cachefly.net/100mb.test'));
final streamedResponse = await client.send(request);
final streamSubscription = streamedResponse.stream.listen(null);
await Future.delayed(const Duration(seconds: 5));
await streamSubscription.cancel();

Despite the stream subscription being cancelled, the connection continues to remain active until the full body is received:

Image

In contrast, the standard IOClient closes the connection when the stream subscription is cancelled. Notice the "Timespan":

Image

Metadata

Metadata

Assignees

Labels

package:cronet_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions