Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_venv fails in Travis with GCC #80159

Closed
tirkarthi opened this issue Feb 12, 2019 · 10 comments
Closed

test_venv fails in Travis with GCC #80159

tirkarthi opened this issue Feb 12, 2019 · 10 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@tirkarthi
Copy link
Member

BPO 35978
Nosy @vstinner, @xdegaye, @zooba, @pablogsal, @miss-islington, @tirkarthi
PRs
  • bpo-35978: Correctly skips venv tests in venvs #12220
  • [3.7] bpo-35978: Correctly skips venv tests in venvs (GH-12220) #12485
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/zooba'
    closed_at = <Date 2019-03-21.17:46:10.772>
    created_at = <Date 2019-02-12.17:37:52.584>
    labels = ['3.8', 'type-bug', '3.7']
    title = 'test_venv fails in Travis with GCC'
    updated_at = <Date 2019-03-21.19:02:33.716>
    user = 'https://github.com/tirkarthi'

    bugs.python.org fields:

    activity = <Date 2019-03-21.19:02:33.716>
    actor = 'xdegaye'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2019-03-21.17:46:10.772>
    closer = 'steve.dower'
    components = []
    creation = <Date 2019-02-12.17:37:52.584>
    creator = 'xtreak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35978
    keywords = ['patch']
    message_count = 10.0
    messages = ['335338', '335354', '335359', '335361', '335363', '335364', '337402', '337407', '338559', '338560']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'xdegaye', 'steve.dower', 'pablogsal', 'miss-islington', 'xtreak']
    pr_nums = ['12220', '12485']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35978'
    versions = ['Python 3.7', 'Python 3.8']

    @tirkarthi
    Copy link
    Member Author

    I noticed this while checking bpo-35961. test_venv is always failing on GCC which is marked as optional in Travis.

    Log : https://travis-ci.org/python/cpython/jobs/492123436#L1909

    0:39:35 load avg: 1.00 [390/416] test_venv
    test test_venv failed -- Traceback (most recent call last):
      File "/home/travis/build/python/cpython/Lib/test/test_venv.py", line 309, in test_multiprocessing
        out, err = check_output([envpy, '-c',
      File "/home/travis/build/python/cpython/Lib/test/test_venv.py", line 37, in check_output
        raise subprocess.CalledProcessError(
    subprocess.CalledProcessError: Command '['/tmp/tmpg8ubeyfn/bin/python', '-c', 'from multiprocessing import Pool; print(Pool(1).apply_async("Python".lower).get(3))']' died with <Signals.SIGABRT: 6>.

    Also GCC test have been timing out for at least past 4 months : https://python.zulipchat.com/#narrow/stream/116742-core.2Fhelp/topic/GCC.20build.20in.20Travis.20always.20times.20out

    @tirkarthi tirkarthi added 3.8 only security fixes type-bug An unexpected behavior, bug, or error labels Feb 12, 2019
    @vstinner
    Copy link
    Member

    Pablo: Can this issue be related bpo-35378?

    commit 3766f18
    Author: Pablo Galindo <Pablogsal@gmail.com>
    Date: Mon Feb 11 17:29:00 2019 +0000

    bpo-35378: Fix multiprocessing.Pool references (GH-11627)
    

    @pablogsal
    Copy link
    Member

    That looks like a similar example of the problem that bpo-35378 solves. But the PR is merged and the test keeps failing:

    test test_venv failed -- Traceback (most recent call last):
      File "/home/travis/build/python/cpython/Lib/test/test_venv.py", line 309, in test_multiprocessing
        out, err = check_output([envpy, '-c',
      File "/home/travis/build/python/cpython/Lib/test/test_venv.py", line 37, in check_output
        raise subprocess.CalledProcessError(
    subprocess.CalledProcessError: Command '['/tmp/tmplplx90pf/bin/python', '-c', 'from multiprocessing import Pool; print(Pool(1).apply_async("Python".lower).get(3))']' died with <Signals.SIGABRT: 6>.

    https://travis-ci.org/python/cpython/jobs/492305033

    Running that command locally on master does not die with SIGABRT:

    ❯ ./python -c 'from multiprocessing import Pool; print(Pool(1).apply_async("Python".lower).get(3))'; echo $?
    python
    /home/pablogsal/github/cpython/Lib/multiprocessing/pool.py:234: ResourceWarning: unclosed running multiprocessing pool <multiprocessing.pool.Pool state=RUN pool_size=1>
    _warn(f"unclosed running multiprocessing pool {self!r}",
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    0

    @vstinner
    Copy link
    Member

    I can reproduce the crash using the same command than the job.

    Simplified commands to reproduce the bug:

    ./configure && make
    ./python -m venv venv
    ./venv/bin/python -m test test_venv -m test.test_venv.BasicTest.test_multiprocessing

    @vstinner
    Copy link
    Member

    The Python of the virtual environment created by the test doesn't work:

    $ /tmp/tmp0vybyos2/bin/python -c pass
    Could not find platform independent libraries <prefix>
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    Fatal Python error: initfsencoding: failed to get the Python codec of the filesystem encoding
    ModuleNotFoundError: No module named 'encodings'

    Current thread 0x00007f2956ab8740 (most recent call first):
    Aborted

    @vstinner
    Copy link
    Member

    Hum, test_executable() of test_venv is skipped if run in a venv, but not test_multiprocessing():

    # If a venv is created from a source build and that venv is used to
    # run the test, the pyvenv.cfg in the venv created in the test will
    # point to the venv being used to run the test, and we lose the link
    # to the source build - so Python can't initialise properly.
    @skipInVenv
        ...
        self.run_with_capture(venv.create, self.env_dir)
        envpy = os.path.join(os.path.realpath(self.env_dir),
                             self.bindir, self.exe)
        ...
    
        def test_multiprocessing(self):
            ...
            self.run_with_capture(venv.create, self.env_dir)
            envpy = os.path.join(os.path.realpath(self.env_dir),
                                 self.bindir, self.exe)
            ...

    The test has been added by:

    commit 4e02f8f
    Author: Steve Dower <steve.dower@microsoft.com>
    Date: Fri Jan 25 14:59:12 2019 -0800

    @zooba
    Copy link
    Member

    zooba commented Mar 7, 2019

    I guess we need a "skipInLinuxVenv", since it works fine on Windows :)

    @zooba
    Copy link
    Member

    zooba commented Mar 7, 2019

    I'm on this. I'll make a new (or possibly complete replacement) for @skipInVenv that is @requireVenvCreate, since that's the common piece that doesn't work in a venv (except on Windows).

    @zooba zooba added the 3.7 (EOL) end of life label Mar 7, 2019
    @zooba zooba self-assigned this Mar 7, 2019
    @zooba
    Copy link
    Member

    zooba commented Mar 21, 2019

    New changeset 8bba81f by Steve Dower in branch 'master':
    bpo-35978: Correctly skips venv tests in venvs (GH-12220)
    8bba81f

    @miss-islington
    Copy link
    Contributor

    New changeset b0967fe by Miss Islington (bot) in branch '3.7':
    bpo-35978: Correctly skips venv tests in venvs (GH-12220)
    b0967fe

    @zooba zooba closed this as completed Mar 21, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants