Skip to content

Emscripten ProxyingQueue doesn't execute task after executing emscripten_fetch #21058

@keminming

Description

@keminming

Please include the following in your bug report:

Version of emscripten/emsdk:
all

We observer after async fetch is invoked and response callback got executed without any error in worker thread with returner pattern by using ProxyingQueue for the first time, no more tasks could be executed by the queue afterwards.

Steps:

  1. setup returner thread:
    _looper = std::thread([this](){ emscripten_runtime_keepalive_push(); });

  2. enqueue a fetch task to ProxyingQueue
    auto requestFn1 = [resp]() mutable { ... emscripten_fetch(...) }; _proxyingQueue.proxyAsync(_session->_looper.native_handle(), requestFn1)

  3. enqueue another task to ProxyingQueue after attr.onsuccess is invoked on the returner
    auto requestFn2 = [resp]() mutable { ... anysimplework(...) }; _proxyingQueue.proxyAsync(_session->_looper.native_handle(), requestFn2)

Observed the requestFn2 is not executed.

Debugged so far:
1 enable -s RUNTIME_DEBUG=1, but there's no log added to the console in headless mode
2 proxyAsync returns 1 in steps 3, however if proxySync is called, the calling thread hangs
3 the returner is still alive during step 3, proved by calling emscripten_async_call recursively with debug information.

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