tornadoweb / tornadoweb/tornado

Soft-deprecate and reimplement IOStream.read_until_close

Open
#3,728 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Description

IOStream.read_until_close is rarely the best choice since it offers poor flow control (delivering the entire data stream as one blob, up to the max_buffer_size limit) and limited error reporting. Its implementation has had subtle bugs due to the way it is handled as a special case in close().

We should soft-deprecate this method and encourage alternatives, primarily calling read_bytes() with partial=True in a loop. We can also remove the special-case functionality in the IOStream internals by replacing read_until_close() itself with such a loop.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating IOStream.read_until_close(), its handling in close(), and the read_bytes() API. Review how partial reads and errors are currently handled, then verify that the method is soft-deprecated, uses the proposed loop, and no longer needs special-case close() behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.