#3728·tornado

Soft-deprecate and reimplement IOStream.read_until_close

Author: bdarnellCreated Sep 15, 2026Updated Sep 15, 2026

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.