Better integration of Wasm stderr into Apache's trace #5
Labels
🚀 enhancement
New feature or request
💡looking for ideas
Issue under discussion and looking for new ideas
Currently, when building the WASI context for the Wasm module, it inherits
stderr
from the Apache process. So all the output tostderr
becomes part of the Apache'serror_log
file, but it's not really integrated into the Apache trace.NOW:
DESIRED:
To solve this, we can replicate the implementation for
stdout
, by having a newVec<u8>
buffer and anotherWritePipe
for theWasiCtx
.But the main difference with
stdout
is when to read it. Thestdout
is read at the end of the execution (and that seems fine). On the other hand, we might want an error sent tostderr
to be printed out to the trace as soon as it happens, so it also gets the right time marks.So, there is no straightforward solution: either we somehow 'listen' to the pipe for new lines, or we might need to read on a time basis (every second?) and pull for new lines during the Wasm execution.
Also, we need to consider how it is returned from
wasm_runtime.so
tomod_wasm.so
; probably by returning a struct to C, sowasm_runtime_run_module() -> *const c_char
would become kind ofwasm_runtime_run_module() -> struct stdio { *const c_char, *const c_char }
. In this regard, this issue is related to #4 since it requires solving how structs can be returned from Rust to C.The text was updated successfully, but these errors were encountered: