vmware-labs / wasm-workers-server

🚀 Develop and run serverless applications on WebAssembly

Home Page:https://workers.wasmlabs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow the Zig SDK to return arbitrarily big responses

ereslibre opened this issue · comments

Describe the bug

At this time, the Zig SDK contains some hardcoded values when preparing the response object for Wasm Workers Server.

We should be able to return arbitrarily big responses from a Zig worker, and so, the Zig SDK should use allocation in order to prepare these responses, regardless of how big the response is.

Reproduction steps

  1. Create a Zig worker following the documentation
  2. Make it return a relatively big response
  3. See crash due to memory limits

Expected behavior

An answer is produced normally, and returned by Wasm Workers Server back to the user.

Additional context

No response

Hi there, great project! Is it okay if I take this on, and also make some additional updates to the Zig SDK and examples? In addition to solving this issue, I'd like to improve memory management (allow user to provide their own allocator, to perform cleanup after writing response to stdout, etc.), update the SDK and examples to use the Zig package manager (in Zig 0.12.0), and fix zig fmt issues in the SDK/example code as of Zig 0.12 (I think zig fmt was more lenient when the wws Zig SDK was initially written).

@sea-grass would be really happy to see this! Happy to help/review! :)

Great, thanks @voigt. I'll get a PR going within the next few days and tag you as a reviewer so we can continue the discussion there!