emscripten-core / emscripten-core/emscripten

Emscripten ProxyingQueue doesn't execute task after executing emscripten_fetch

Open
#21,058 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.