You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In execution_ctx.rsrun() method, the WASM_RUNTIME_EXECUTIONCTXS hash map is locked as read() during the Wasm module execution.
This means new threads (new HTTP incoming requests) can't create new execution contexts since that would require exclusive write() access.
In a 'normal' scenario, this is suboptimal because it might lead to a situation where Apache is allocating more resources than mod_wasm can leverage.
But in an adverse scenario, if a Wasm module execution takes longer than usual (or hangs up), that might block other incoming requests.
Since CPU-limited executions are not implemented yet (see #9), it would be much better to ensure that the WASM_RUNTIME_EXECUTIONCTXS hash map is not locked at all during the Wasm module execution.
Reproduction steps
Create a configuration with two different locations:
a) /intense_task, whose Wasm execution takes a long time (ie: 10secs)
b) /light_task, a very simple and immediate task
Start up Apache and check both locations works as expected.
Then load /intense_task, and right after, try loading /light_task: It should be obvious that such /light_task won't start until /intense_task is done.
Expected behavior
In a mono-thread scenario (ie.: httpd -X), new requests are queued and dispatched one by one.
In a multi-threading scenario, new requests shouldn't be delayed because other requests are running the Wasm module.
Additional context
This issue was reported by @juamedgod, who noticed a wrong behavior while testing a dev version of PHP.wasm whose execution never finished. Thanks for reporting!!
The text was updated successfully, but these errors were encountered:
Describe the bug
In execution_ctx.rs
run()
method, theWASM_RUNTIME_EXECUTIONCTXS
hash map is locked asread()
during the Wasm module execution.This means new threads (new HTTP incoming requests) can't create new execution contexts since that would require exclusive
write()
access.In a 'normal' scenario, this is suboptimal because it might lead to a situation where Apache is allocating more resources than mod_wasm can leverage.
But in an adverse scenario, if a Wasm module execution takes longer than usual (or hangs up), that might block other incoming requests.
Since CPU-limited executions are not implemented yet (see #9), it would be much better to ensure that the
WASM_RUNTIME_EXECUTIONCTXS
hash map is not locked at all during the Wasm module execution.Reproduction steps
/intense_task
, whose Wasm execution takes a long time (ie: 10secs)/light_task
, a very simple and immediate task/intense_task
, and right after, try loading/light_task
: It should be obvious that such/light_task
won't start until/intense_task
is done.Expected behavior
In a mono-thread scenario (ie.:
httpd -X
), new requests are queued and dispatched one by one.In a multi-threading scenario, new requests shouldn't be delayed because other requests are running the Wasm module.
Additional context
This issue was reported by @juamedgod, who noticed a wrong behavior while testing a dev version of PHP.wasm whose execution never finished. Thanks for reporting!!
The text was updated successfully, but these errors were encountered: