Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: WASM program with WASI exit status doesn't propagate to http status code of worker #3702

Closed
seongs1024 opened this issue Aug 2, 2023 · 2 comments
Labels
awaiting reporter response Needs clarification or followup from OP bug Something that isn't working

Comments

@seongs1024
Copy link

seongs1024 commented Aug 2, 2023

Which Cloudflare product(s) does this pertain to?

Workers Runtime, Wrangler core

What version(s) of the tool(s) are you using?

wrangler 0.0.0-c0d7699

What version of Node are you using?

20.5.0

What operating system are you using?

WSL 1 on Windows 11

Describe the Bug

The HTTP status code always 200 even where the WASM/WASI program exit with the system status of 1 (not zero), or where the program stopped unexpectedly.

2:19:03 AM POST / 200

✘ [ERROR] Uncaught (in promise) RuntimeError: unreachable
      at __rust_start_panic
  (wasm://wasm/008579b6:wasm-function[224]:0xe4d9)
      at rust_panic (wasm://wasm/008579b6:wasm-function[215]:0xe29a)
✘ [ERROR] Uncaught (async) CompileError: unreachable
✘ [ERROR] Uncaught (in promise) RuntimeError: unreachable

A definately success request and response case are:

curl -X POST localhost:8787 --data '{"x": 7, "y": 9}' -v

> HTTP/1.1 200 OK
> ...
> You typed: Point { x: 7, y: 9 }

Awkward request and response case are:

curl -X POST localhost:8787 --data '{"x": 7, "y ' -v

> HTTP/1.1 200 OK  <-- it should be like 404 or 500 whatever related with error code though....
> ...
>                  <-- because it was not responsed

Please provide a link to a minimal reproduction

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=635c9deb39ea0db13019d6b813b189f4

Please provide any relevant error logs

✘ [ERROR] Uncaught (in promise) Error: proc_exit=1

      at WASI.proc_exit_fn (index.js:748:9)
      at __wasi_proc_exit
  (wasm://wasm/0085943e:wasm-function[252]:0x119cd)
      at _start (wasm://wasm/0085943e:wasm-function[6]:0x478)
      at WASI.start (index.js:543:9)


✘ [ERROR] Uncaught (async) Error: proc_exit=1


2:48:47 AM POST / 200
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1:8787...
* Connected to localhost (127.0.0.1) port 8787 (#0)
> POST / HTTP/1.1
> Host: localhost:8787
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 12
> Content-Type: application/x-www-form-urlencoded
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< date: Wed, 02 Aug 2023 17:43:30 GMT
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=<sth_value>"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
< cf-ray: <sth_value>
< alt-svc: h3=":443"; ma=86400
< server: cloudflare
< Connection: keep-alive
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< 
* Connection #0 to host localhost left intact
@seongs1024 seongs1024 added the bug Something that isn't working label Aug 2, 2023
@seongs1024 seongs1024 changed the title 🐛 BUG: WASI program exit status doesn't propagate to http status code of worker 🐛 BUG: WASM program with WASI exit status doesn't propagate to http status code of worker Aug 2, 2023
@RamIdeas
Copy link
Contributor

Hi @SebastiaanYN! Can you provide a minimal reproduction of your worker code? The minimal reproduction provided is only the rust code and is missing your Workers setup. Also, I noticed you're using a beta version, can you try on Wrangler's latest version please?

@RamIdeas RamIdeas added the awaiting reporter response Needs clarification or followup from OP label Dec 18, 2023
@RamIdeas
Copy link
Contributor

RamIdeas commented Jan 8, 2024

Hi @SebastiaanYN 👋 We haven't heard from you in a while, so we’re going to close this issue for now. If this is still a problem, please feel free to open a new issue referencing this one. Please be sure to include an updated summary and any additional requested details, followup, or context and we will revisit and investigate further. Thanks!

@RamIdeas RamIdeas closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reporter response Needs clarification or followup from OP bug Something that isn't working
Projects
None yet
Development

No branches or pull requests

2 participants