[New-bugs-announce] [issue33733] Add utilities to get/set pipe and socket buffer sizes?

STINNER Victor report at bugs.python.org
Fri Jun 1 09:18:19 EDT 2018


New submission from STINNER Victor <vstinner at redhat.com>:

Many Python unit tests require a blocking send into a pipe or a socket.

support.PIPE_MAX_SIZE (4 MiB +1 B) has been added for pipes in bpo-17835: sending PIPE_MAX_SIZE into a pipe must block.

On Linux, the maximum size of a pipe is /proc/sys/fs/pipe-max-size. Since Linux 2.6.35, it's now possible to get and set the size of a pipe using fcntl with F_GETPIPE_SZ and F_SETPIPE_SZ commands.

For sockets, support.SOCK_MAX_SIZE (16 MiB) has been added in bpo-18643. It's possible to get/set the size of receive and send socket buffers using getsockopt() and setsockopt() with SO_RCVBUF and SO_SNDBUF commands.

For pipes, I'm not sure that it's possible to get the size of a pipe buffer in a portable way. For example, F_GETPIPE_SZ was only introduced in Linux 2.6.35.

Since the first user of these features are tests, maybe we can start with best-effort functions in test.support.

Recently, I got issues with buffer sizes in test_multiprocessing_forkserver.test_ignore() (bpo-33532) and sendfile tests of test_asyncio (bpo-33353).

----------
components: Library (Lib)
messages: 318411
nosy: pitrou, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: Add utilities to get/set pipe and socket buffer sizes?
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33733>
_______________________________________


More information about the New-bugs-announce mailing list