Skip to content

Closing a StreamingBody does not close the socket #1370

@timuralp

Description

@timuralp

The botocore.response.StreamingBody (https://github.com/boto/botocore/blob/develop/botocore/response.py#L29) class defines a close method. However, closing a StreamingBody does not result in closing the socket if not all of the bytes were consumed. I verified this behavior by looking at packet traces after making a request for a large object in S3. Here is a code snippet to reproduce the behavior:

import boto3
import time

client = boto3.client('s3')
resp = client.get_object(Bucket='test', Key='large')
resp['Body'].close()
time.sleep(10)

The RST packet should be sent after calling close(). Currently, I see it sent 10 seconds later, when the program exits (and a number of ZeroWindow messages in between).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a confirmed bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions