Problems with the Attach API implementation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
This is the same as awslabs/aws-sam-cli#1551
We hit that first, then doing the investigation we realised that the same might be true for docker-py.
The gist is that when pilfering the socket descriptor in
the subsequent
might end up trying to read from a socket which is already at EOF because all the muxed binary protocol data has been swallowed by the 8KB pull-up done by the requests.Response object when reading the response to the POST /containers/.../attach?...
The thing is that when taking ownership of the underlying socket it's also necessary to collect what's possibly left in the requests.Reponse input buffer and start consuming all of that before reading from the socket.
(FYI, there is a proof-of-concept fix attached to awslabs/aws-sam-cli#1551)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docker/api/client.py around the socket descriptor handling and docker/utils/socket.py around socket reads, then compare the POST /containers/.../attach response path with the proof-of-concept referenced in awslabs/aws-sam-cli#1551. Done means attach reliably consumes any buffered response data before reading the underlying socket, including when the socket is already at EOF.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100