Skip to content

Race condition during build causing errors with default Python 2.x #39456

@mscdex

Description

@mscdex

Version

master

Platform

Linux foo 5.4.0-58-generic #64~18.04.1-Ubuntu SMP Wed Dec 9 17:11:11 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

build

What steps will reproduce the bug?

No response

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

There is a race condition occurring when building node where one or more build steps are executed before the python environment is properly set up (e.g. modifying PATH to include a path in out/ containing a symlink to the detected Python 3.x binary). I have Python 2.x as /usr/bin/python but Python 3.6 is also installed (as /usr/bin/python3 and /usr/bin/python3.6).

When the environment isn't set up properly first the build (using make -j 8 for example) fails with:

Traceback (most recent call last):
  File "tools/js2c.py", line 234, in <module>
    main()
  File "tools/js2c.py", line 219, in main
    js_files = utils.SearchFiles(options.directory, 'js')
  File "/home/foo/git/node/tools/utils.py", line 112, in SearchFiles
    list = glob.glob(dir+ '/**/*.' + ext, recursive=True)
TypeError: glob() got an unexpected keyword argument 'recursive'
  touch e6bf3e61ac02f989b2a33f551be26b7ec4082ec4.intermediate
libnode.target.mk:13: recipe for target '/home/foo/git/node/out/Release/obj/gen/node_javascript.cc' failed

At this point if I perform make (without a -j argument), then it works fine and once it gets past the part it was failing on I can abort the build and re-run make -j xxx and everything works fine from then on.

If I had to guess the command it's failing on it might be:

LD_LIBRARY_PATH=/home/foo/git/node/out/Release/lib.host:/home/foo/git/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /home/foo/git/node/out/Release/obj/gen; python tools/js2c.py --directory lib --target "/home/foo/git/node/out/Release/obj/gen/node_javascript.cc" config.gypi deps/v8/tools/splaytree.mjs deps/v8/tools/codemap.mjs deps/v8/tools/consarray.mjs deps/v8/tools/csvparser.mjs deps/v8/tools/profile.mjs deps/v8/tools/profile_view.mjs deps/v8/tools/logreader.mjs deps/v8/tools/arguments.mjs deps/v8/tools/tickprocessor.mjs deps/v8/tools/sourcemap.mjs deps/v8/tools/tickprocessor-driver.mjs deps/acorn/acorn/dist/acorn.js deps/acorn/acorn-walk/dist/walk.js deps/cjs-module-lexer/lexer.js deps/cjs-module-lexer/dist/lexer.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to build files or the CI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions