Skip to content

CPython-WASM interpreter (python.wasm) never exits the program when it is built on WASI-SDK 27 #137580

@fernwehist

Description

@fernwehist

Bug report

Bug description:

Hi. WASI-SDK has been updated to 27 from 25.

I updated it and built CPython-WASM interpreter (python.wasm).
Compiled well.

However, it hangs a program and never exits the program.
For example, at the last step of building python.wasm,
i.e.) Tools/wasm/wasi.py build -- --config-cache --with-pydebug
there's a simple version check step.
i.e.) python_3.14.0rc1/python/cross-build/wasm32-wasip1/python.sh --version

it hangs forever.
I have to interrupt by Ctrl+C and then it prints like this:

python_3.14.0rc1/python/cross-build/wasm32-wasip1/python.sh --version
Python 3.14.0rc1

Traceback (most recent call last):
  File "~/python_3.14.0rc1/python/build/lib/python3.14/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
                     "__main__", mod_spec)
  File "~/python_3.14.0rc1/python/build/lib/python3.14/runpy.py", line 88, in _run_code
    exec(code, run_globals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "~/python_3.14.0rc1/python/Tools/wasm/wasi/__main__.py", line 374, in <module>
    main()
    ~~~~^^
  File "~/python_3.14.0rc1/python/Tools/wasm/wasi/__main__.py", line 370, in main
    dispatch[context.subcommand](context)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "~/python_3.14.0rc1/python/Tools/wasm/wasi/__main__.py", line 291, in build_all
    step(context)
    ~~~~^^^^^^^^^
  File "~/python_3.14.0rc1/python/Tools/wasm/wasi/__main__.py", line 86, in wrapper
    return func(context, working_dir)
  File "~/python_3.14.0rc1/python/Tools/wasm/wasi/__main__.py", line 279, in make_wasi_python
    call([exec_script, "--version"], quiet=False)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/python_3.14.0rc1/python/Tools/wasm/wasi/__main__.py", line 110, in call
    subprocess.check_call(command, **kwargs, stdout=stdout, stderr=stderr)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/python_3.14.0rc1/python/build/lib/python3.14/subprocess.py", line 414, in check_call
    retcode = call(*popenargs, **kwargs)
  File "~/python_3.14.0rc1/python/build/lib/python3.14/subprocess.py", line 397, in call
    return p.wait(timeout=timeout)
           ~~~~~~^^^^^^^^^^^^^^^^^
  File "~/python_3.14.0rc1/python/build/lib/python3.14/subprocess.py", line 1278, in wait
    return self._wait(timeout=timeout)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "~/python_3.14.0rc1/python/build/lib/python3.14/subprocess.py", line 2064, in _wait
    (pid, sts) = self._try_wait(0)
                 ~~~~~~~~~~~~~~^^^
  File "~/python_3.14.0rc1/python/build/lib/python3.14/subprocess.py", line 2022, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
                 ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^

Tested on wasmtime 35.0.0 and wasmedge 0.15.0

And I did double check with WASI-SDK 25, everything was fine.

Thank you.

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-wasibuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions