Skip to content

Windows: emrun.py does not exit as expected #22578

@Markus87

Description

@Markus87

After the program in the browser finished emrun just hangs at: httpd.server_close()

Command:

emrun --verbose --browser=chrome --browser_args="--headless --disable-gpu --remote-debugging-port=9222" --kill_exit SomeTest.html -- --run_test=* --log_level=test_suite

Output:

Web server root directory: D:\BitFactory\Alex\wasm\Bin\Emscripten_RelWithDebInfo
Starting web server: http://0.0.0.0:6931/
Starting browser: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --headless --disable-gpu --remote-debugging-port=9222 --enable-nacl --enable-pnacl --disable-restore-session-state --enable-webgl --no-default-browser-check --no-first-run --allow-file-access-from-files http://localhost:6931/Bfx.Alex.UnitTest.ComputationOutputStateHasError.html?--run_test=*&--log_level=test_suite
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
import psutil failed, unable to detect browser processes
Searching for processes by full path name "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe".. found 0 entries
Launched browser process with pid=17636
Entering web server loop.
First navigation occurred. Identifying currently running browser processes
import psutil failed, unable to detect browser processes
Searching for processes by full path name "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe".. found 0 entries
Was unable to detect the browser process that was spawned by emrun. This may occur if the target page was opened in a tab on a browser process that already existed before emrun started up.
Web page has quit with a call to exit() with return code 0. Shutting down web server. Pass --serve_after_exit to keep serving even after the page terminates with exit().
Web server loop done.

Possible fix: (Disclaimer: I have no python skills)

  def serve_forever(self, timeout=0.5):
    global last_message_time, page_exit_code, emrun_not_enabled_nag_printed
    socketserver.ThreadingMixIn.block_on_close = False    #+ fixes it for me
    self.is_running = True

I am not sure if this is a problem on operating systems other than Windows.
It also looks like the python deployed with emsdk is missing a module 'psutil'. I guess this would cause --kill_start to not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions