Skip to content

gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset#150270

Merged
kumaraditya303 merged 2 commits into
python:mainfrom
grantlouisherman:bugfix-150107-asyncio-offset
May 29, 2026
Merged

gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset#150270
kumaraditya303 merged 2 commits into
python:mainfrom
grantlouisherman:bugfix-150107-asyncio-offset

Conversation

@grantlouisherman
Copy link
Copy Markdown
Contributor

Original Bug Report:

Bug report

Bug description:

BaseEventLoop._sock_sendfile_fallback (https://github.com/python/cpython/blob/main/Lib/asyncio/base_events.py#L971) erroneously doesn't seek when passed the offset 0.

        if offset:
            file.seek(offset)

This check in the function doesn't call file.seek if offset is falsey. If the file in question has a file pointer that is not currently at the 0 offset then this will erroneously send from the current offset and not the start of the file as desired. This can happen when sendfile is called with the destination socket is an SSL socket.

Repro code (generated by Claude), because of needing to create an SSL socket it's a bit involved - including making a self signed cert with the openssl command.

import asyncio
import os
import ssl
import subprocess
import sys
import tempfile
from pathlib import Path

CONTENT = b"X" * 1000


def make_throwaway_cert(tmp: Path) -> tuple[Path, Path]:
    cert = tmp / "cert.pem"
    key = tmp / "key.pem"
    subprocess.run(
        [
            "openssl", "req", "-x509", "-newkey", "rsa:2048", "-nodes",
            "-keyout", str(key), "-out", str(cert),
            "-days", "1", "-subj", "/CN=localhost",
        ],
        check=True,
        capture_output=True,
    )
    return cert, key


async def main() -> int:
    with tempfile.TemporaryDirectory() as tmp_:
        tmp = Path(tmp_)
        cert, key = make_throwaway_cert(tmp)

        data_path = tmp / "data"
        data_path.write_bytes(CONTENT)

        # SSL server that drains whatever it receives.
        server_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
        server_ctx.load_cert_chain(cert, key)
        received = 0
        done = asyncio.Event()

        async def handle(reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None:
            nonlocal received
            try:
                while chunk := await reader.read(4096):
                    received += len(chunk)
            finally:
                writer.close()
                done.set()

        server = await asyncio.start_server(handle, "127.0.0.1", 0, ssl=server_ctx)
        port = server.sockets[0].getsockname()[1]

        # SSL client → transport's `_sendfile_compatible == UNSUPPORTED` → fallback path.
        client_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
        client_ctx.check_hostname = False
        client_ctx.verify_mode = ssl.CERT_NONE
        _, writer = await asyncio.open_connection(
            "127.0.0.1", port, ssl=client_ctx, server_hostname="localhost"
        )

        # Open the file and pre-advance its position. In the real-world bug
        # this happens because the calling code previously read through the
        # same fh (e.g. to parse an HTTP header).
        f = open(data_path, "rb", buffering=0)
        f.seek(len(CONTENT))  # file position is at EOF

        # Send from offset=0. Expectation: 1000 bytes transferred.
        loop = asyncio.get_running_loop()
        sent = await loop.sendfile(writer.transport, f, offset=0)

        writer.close()
        await writer.wait_closed()
        await done.wait()
        server.close()
        await server.wait_closed()
        f.close()

        print(f"Python:       {sys.version}")
        print(f"file size:    {len(CONTENT)}")
        print(f"file.tell() before sendfile: {len(CONTENT)} (EOF)")
        print(f"loop.sendfile(..., offset=0) returned: {sent}")
        print(f"server received: {received} bytes")
        print()

        if sent == 0 and received == 0:
            print("BUG REPRODUCED: offset=0 was ignored; the fallback read from "
                  "file.tell() instead of from the requested offset.")
            return 1
        else:
            print("Bug NOT reproduced on this Python build.")
            return 0


sys.exit(asyncio.run(main()))

The relevant lines are the line f.seek(len(CONTENT)) and the line sent = await loop.sendfile(writer.transport, f, offset=0). Most of the rest is setup and teardown.

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux

Fix

I think what I did was correct or understood the issue, but essentially as far as I could understand 0 is always falsey so if offset was ever set to zero than the file.seek wasent happening even though 0 offset is a legitimate offset. I simply just did an instance on offset to make sure it is an int and then the f.seek goes through. I validated with the repro command and passing unit tests.

@vstinner
Copy link
Copy Markdown
Member

We should also fix the issue in sendfile(). See my draft adding tests: #150142 (comment). The problem is that sock_sendfile() and sendfile() don't have a consistent seek() behavior. Depending on the code path, seek() may be called or not. We should make asyncio more consistent for that.

@grantlouisherman
Copy link
Copy Markdown
Contributor Author

Sure @vstinner I must have missed that comment.

@grantlouisherman grantlouisherman force-pushed the bugfix-150107-asyncio-offset branch 2 times, most recently from 688d182 to 3b33313 Compare May 26, 2026 03:00
@grantlouisherman
Copy link
Copy Markdown
Contributor Author

So in @vstinner from doing some digging and playing around with this I essentially updated the unix event to always update the file pointers based on the current offset. I think the previous guard was buggy, obviously exposed by the test you drafted, where if total sent returned 0 which was the case when we were EOF a file pointer wouldnt get updated because total sent would == 0. Let me know your thoughts

@grantlouisherman grantlouisherman force-pushed the bugfix-150107-asyncio-offset branch from dc70850 to 2a884c8 Compare May 26, 2026 14:14
@grantlouisherman
Copy link
Copy Markdown
Contributor Author

@1st1 is there anything Im missing from this?

Signed-off-by: grantlouisherman <grantlouisherman041@gmail.com>
@grantlouisherman grantlouisherman force-pushed the bugfix-150107-asyncio-offset branch from 4a681cd to 19edc6b Compare May 28, 2026 14:32
@grantlouisherman
Copy link
Copy Markdown
Contributor Author

Hey @vstinner is there anything else that should be added?

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kumaraditya303: Do you want to double check the change?

Comment thread Lib/test/test_asyncio/test_sendfile.py
Co-authored-by: Victor Stinner <vstinner@python.org>
@kumaraditya303 kumaraditya303 merged commit c72d5ea into python:main May 29, 2026
52 checks passed
@kumaraditya303 kumaraditya303 added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels May 29, 2026
@miss-islington-app
Copy link
Copy Markdown

Thanks @grantlouisherman for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app
Copy link
Copy Markdown

Thanks @grantlouisherman for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@miss-islington-app
Copy link
Copy Markdown

Thanks @grantlouisherman for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 29, 2026

GH-150569 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 29, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 29, 2026

GH-150570 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 29, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 29, 2026

GH-150571 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label May 29, 2026
kumaraditya303 pushed a commit that referenced this pull request May 29, 2026
…set (GH-150270) (#150571)

gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270)
(cherry picked from commit c72d5ea)

Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
kumaraditya303 pushed a commit that referenced this pull request May 29, 2026
…set (GH-150270) (#150570)

gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270)
(cherry picked from commit c72d5ea)

Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
kumaraditya303 pushed a commit that referenced this pull request May 29, 2026
…set (GH-150270) (#150569)

gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270)
(cherry picked from commit c72d5ea)

Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
@grantlouisherman grantlouisherman deleted the bugfix-150107-asyncio-offset branch May 29, 2026 18:03
@bedevere-bot
Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Arch Linux Asan 3.14 (no tier) has failed when building commit 8d050f9.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1806/builds/324) and take a look at the build logs.
  4. Check if the failure is related to this commit (8d050f9) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1806/builds/324

Failed tests:

  • test_venv

Failed subtests:

  • test_with_pip - test.test_venv.EnsurePipTest.test_with_pip

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "<frozen runpy>", line 203, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/ensurepip/__init__.py", line 258, in _main
    return _bootstrap(
        root=args.root,
    ...<4 lines>...
        default_pip=args.default_pip,
    )
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/ensurepip/__init__.py", line 154, in _bootstrap
    with tempfile.TemporaryDirectory() as tmpdir:
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/tempfile.py", line 907, in __init__
    self.name = mkdtemp(suffix, prefix, dir)
                ~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/tempfile.py", line 381, in mkdtemp
    _os.mkdir(file, 0o700)
    ~~~~~~~~~^^^^^^^^^^^^^
OSError: [Errno 28] No space left on device: '/tmp/test_python_8hemdgk6/tmpzolmfxtd'


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 1070, in nicer_error
    yield
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 998, in do_test_with_pip
    self.run_with_capture(venv.create, self.env_dir,
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          system_site_packages=system_site_packages,
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          with_pip=True)
                          ^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 103, in run_with_capture
    func(*args, **kwargs)
    ~~~~^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 613, in create
    builder.create(env_dir)
    ~~~~~~~~~~~~~~^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 82, in create
    self._setup_pip(context)
    ~~~~~~~~~~~~~~~^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 458, in _setup_pip
    self._call_new_python(context, '-m', 'ensurepip', '--upgrade',
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          '--default-pip', stderr=subprocess.STDOUT)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 454, in _call_new_python
    subprocess.check_output(args, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/subprocess.py", line 473, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/subprocess.py", line 578, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/tmp/test_python_1vjsm7vc/tmpmdm3dc6h/bin/python', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 628, in test_multiprocessing
    out, err = check_output([self.envpy(real_env_dir=True), '-c',
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'from multiprocessing import Pool; '
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'pool = Pool(1); '
        ^^^^^^^^^^^^^^^^^^
        'print(pool.apply_async("Python".lower).get(3)); '
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'pool.terminate()'])
        ^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 58, in check_output
    raise subprocess.CalledProcessError(
        p.returncode, cmd, out, err)
subprocess.CalledProcessError: Command '['/tmp/test_python_8hemdgk6/tmp2r6fx2gu/bin/python', '-c', 'from multiprocessing import Pool; pool = Pool(1); print(pool.apply_async("Python".lower).get(3)); pool.terminate()']' returned non-zero exit status 1.


Traceback (most recent call last):
  File "<frozen runpy>", line 203, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/ensurepip/__init__.py", line 258, in _main
    return _bootstrap(
        root=args.root,
    ...<4 lines>...
        default_pip=args.default_pip,
    )
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/ensurepip/__init__.py", line 154, in _bootstrap
    with tempfile.TemporaryDirectory() as tmpdir:
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/tempfile.py", line 907, in __init__
    self.name = mkdtemp(suffix, prefix, dir)
                ~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/tempfile.py", line 381, in mkdtemp
    _os.mkdir(file, 0o700)
    ~~~~~~~~~^^^^^^^^^^^^^
OSError: [Errno 28] No space left on device: '/tmp/test_python_1vjsm7vc/tmpdvmchnv3'


Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from multiprocessing import Pool; pool = Pool(1); print(pool.apply_async("Python".lower).get(3)); pool.terminate()
                                             ~~~~^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
                context=self.get_context())
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/pool.py", line 215, in __init__
    self._repopulate_pool()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/pool.py", line 306, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
                                        self._processes,
                                        ^^^^^^^^^^^^^^^^
    ...<3 lines>...
                                        self._maxtasksperchild,
                                        ^^^^^^^^^^^^^^^^^^^^^^^
                                        self._wrap_exception)
                                        ^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/pool.py", line 329, in _repopulate_pool_static
    w.start()
    ~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
                  ~~~~~~~~~~~^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/context.py", line 306, in _Popen
    return Popen(process_obj)
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/popen_forkserver.py", line 35, in __init__
    super().__init__(process_obj)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/popen_fork.py", line 20, in __init__
    self._launch(process_obj)
    ~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/popen_forkserver.py", line 51, in _launch
    self.sentinel, w = forkserver.connect_to_new_process(self._fds)
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/forkserver.py", line 89, in connect_to_new_process
    self.ensure_running()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/forkserver.py", line 166, in ensure_running
    address = connection.arbitrary_address('AF_UNIX')
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/connection.py", line 82, in arbitrary_address
    return os.path.join(util.get_temp_dir(),
                        ~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/util.py", line 217, in get_temp_dir
    tempdir = tempfile.mkdtemp(prefix='pymp-', dir=base_tempdir)
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/tempfile.py", line 381, in mkdtemp
    _os.mkdir(file, 0o700)
    ~~~~~~~~~^^^^^^^^^^^^^
OSError: [Errno 28] No space left on device: '/tmp/test_python_1vjsm7vc/pymp-gzlj_fct'


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 1083, in test_with_pip
    self.do_test_with_pip(False)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 997, in do_test_with_pip
    with self.nicer_error():
         ~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 1074, in nicer_error
    self.fail(
    ~~~~~~~~~^
        f"{exc}\n\n"
        ^^^^^^^^^^^^
        f"**Subprocess Output**\n{out}\n\n"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        f"**Subprocess Error**\n{err}"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: Command '['/tmp/test_python_8hemdgk6/tmpl67bng54/bin/python', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 1070, in nicer_error
    yield
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 998, in do_test_with_pip
    self.run_with_capture(venv.create, self.env_dir,
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          system_site_packages=system_site_packages,
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          with_pip=True)
                          ^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 103, in run_with_capture
    func(*args, **kwargs)
    ~~~~^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 613, in create
    builder.create(env_dir)
    ~~~~~~~~~~~~~~^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 82, in create
    self._setup_pip(context)
    ~~~~~~~~~~~~~~~^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 458, in _setup_pip
    self._call_new_python(context, '-m', 'ensurepip', '--upgrade',
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          '--default-pip', stderr=subprocess.STDOUT)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/venv/__init__.py", line 454, in _call_new_python
    subprocess.check_output(args, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/subprocess.py", line 473, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/subprocess.py", line 578, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/tmp/test_python_8hemdgk6/tmpl67bng54/bin/python', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 1083, in test_with_pip
    self.do_test_with_pip(False)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 997, in do_test_with_pip
    with self.nicer_error():
         ~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 1074, in nicer_error
    self.fail(
    ~~~~~~~~~^
        f"{exc}\n\n"
        ^^^^^^^^^^^^
        f"**Subprocess Output**\n{out}\n\n"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        f"**Subprocess Error**\n{err}"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: Command '['/tmp/test_python_1vjsm7vc/tmpmdm3dc6h/bin/python', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.


Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from multiprocessing import Pool; pool = Pool(1); print(pool.apply_async("Python".lower).get(3)); pool.terminate()
                                             ~~~~^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
                context=self.get_context())
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/pool.py", line 215, in __init__
    self._repopulate_pool()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/pool.py", line 306, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
                                        self._processes,
                                        ^^^^^^^^^^^^^^^^
    ...<3 lines>...
                                        self._maxtasksperchild,
                                        ^^^^^^^^^^^^^^^^^^^^^^^
                                        self._wrap_exception)
                                        ^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/pool.py", line 329, in _repopulate_pool_static
    w.start()
    ~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
                  ~~~~~~~~~~~^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/context.py", line 306, in _Popen
    return Popen(process_obj)
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/popen_forkserver.py", line 35, in __init__
    super().__init__(process_obj)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/popen_fork.py", line 20, in __init__
    self._launch(process_obj)
    ~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/popen_forkserver.py", line 51, in _launch
    self.sentinel, w = forkserver.connect_to_new_process(self._fds)
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/forkserver.py", line 89, in connect_to_new_process
    self.ensure_running()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/forkserver.py", line 166, in ensure_running
    address = connection.arbitrary_address('AF_UNIX')
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/connection.py", line 82, in arbitrary_address
    return os.path.join(util.get_temp_dir(),
                        ~~~~~~~~~~~~~~~~~^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/util.py", line 217, in get_temp_dir
    tempdir = tempfile.mkdtemp(prefix='pymp-', dir=base_tempdir)
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/tempfile.py", line 381, in mkdtemp
    _os.mkdir(file, 0o700)
    ~~~~~~~~~^^^^^^^^^^^^^
OSError: [Errno 28] No space left on device: '/tmp/test_python_8hemdgk6/pymp-py57v4kn'


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 628, in test_multiprocessing
    out, err = check_output([self.envpy(real_env_dir=True), '-c',
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'from multiprocessing import Pool; '
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'pool = Pool(1); '
        ^^^^^^^^^^^^^^^^^^
        'print(pool.apply_async("Python".lower).get(3)); '
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'pool.terminate()'])
        ^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.14.pablogsal-arch-x86_64.asan/build/Lib/test/test_venv.py", line 58, in check_output
    raise subprocess.CalledProcessError(
        p.returncode, cmd, out, err)
subprocess.CalledProcessError: Command '['/tmp/test_python_1vjsm7vc/tmpejuhz6uu/bin/python', '-c', 'from multiprocessing import Pool; pool = Pool(1); print(pool.apply_async("Python".lower).get(3)); pool.terminate()']' returned non-zero exit status 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants