-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Certain ascii characters crash WASM when received from server fn #2377
Comments
Stuff like this is why I switched to stable |
Do you have a minimal reproduction of a server function that can trigger this panic? |
I'll have one soon. Further investigation finds this works fine on The merged PR is rust-lang/rust#120777 which mentions doing unicode things |
For note, the dash you put in the post here is not ascii (it is indeed a UTF-8 en-dash in this case, but github 'unifies' everything to utf-8 in posts anyway regardless of its source), copy pasted into a rust repl: >> "–".as_bytes()
[226, 128, 147] Are you sure that in the page it's utf-8 and not something else like utf-16 or so? |
Sorry, I'm bad with terminology on ascii vs utf. It is a character, that was given by a server function, that I used to be able to receive ok. |
If you debug in sending it on the server side pre-serialization is it parsed into a rust |
https://github.com/jollygreenlaser/ascii-death repro In short:
@OvermindDL1 thanks for the suggestion, will try that next |
Also happens in Actix: https://github.com/jollygreenlaser/actix-death |
Further testing shows that string length may have a minimum. What I thought was "requires something after in the struct" may actually be this. It seems all that matters is number of bytes after the unwanted character. Replacing
Also causes the same crash. Even just one fewer |
For anyone else running into the problem, this seems like a good issue thread. |
@jollygreenlaser How can I get ascii-death/actix-death running locally? (I've gotten as far as getting wasm-pack to build it successfully with my instrumented allocator.) I'm hoping it might be possible to isolate the code producing the bad allocation with such a small repro. |
Hello, There has been certain amount of investigation by @SFBdragon : rustwasm/wasm-pack#1389 (comment)
Quoting my comment in the issue dlmalloc (alexcrichton/dlmalloc-rs#41): For anyone landing on this issue, it seems that in the latest revision on
https://github.com/rustwasm/wasm-bindgen/blob/0.2.92/CHANGELOG.md#fixed-1 OR
https://github.com/rustwasm/wasm-bindgen/blob/0.2.92/CHANGELOG.md#0287 |
This seems to be working on latest nightly after upgrading to |
EDIT: Current fix is to revert to
nightly-2024-02-14
:rustup default nightly-2024-02-14
, may need torustup target add wasm32-unknown-unknown
again and if using cranelift,rustup component add rustc-codegen-cranelift-preview --toolchain nightly-2024-02-14
. If using one, eg as done by default withcargo-leptos
, update therust-toolchain.toml
file as well.Describe the bug
Latest nightly breaks receiving certain characters from a server function, showing a
dmalloc
error. For me, it was en dash (–
) and likely includes others. Unclear what caused this to suddenly break or what the true origin is.This happens either upon navigating to the page with the server function call or during hydration when refreshing on that page.
This is very annoying for anything that has to display user entered data, eg profile bios.
Luckily the current workaround is pretty simple, just use this util all over the place:
This started happening after upgrading my nightly from late January. Due to testing a separate bug I've been able to repro this bug on 0.6.5, 0.6.6 and the tip of main version I'm on. I have a deployed 0.6.5, late January nightly version without this issue.
It feels very likely that the issue is in a dependency rather than Leptos proper. However, I've not been able to track this down at all despite a lot of effort and I'm guessing others will start to hit it too.
Leptos Dependencies
https://github.com/leptos-rs/leptos/tree/6d6019b956c81b2ec86e3aab7dd0e93db54dca3e
Screenshot:
Text:
The text was updated successfully, but these errors were encountered: