Skip to content

Conversation

@tekacs
Copy link
Contributor

@tekacs tekacs commented Nov 3, 2025

Try to resolve #4902.

@tekacs tekacs marked this pull request as ready for review November 3, 2025 23:33
@tekacs tekacs requested a review from a team as a code owner November 3, 2025 23:33
@tekacs tekacs force-pushed the async-subsecond-handler branch 4 times, most recently from c59446f to 3eb51fe Compare November 23, 2025 02:28
@tekacs tekacs force-pushed the async-subsecond-handler branch from 3eb51fe to da87dd3 Compare December 1, 2025 01:21
@jkelleyrtp
Copy link
Member

I closed the other PR since we definitely don't want to run all handlers async, but you said this is the branch you're using to dev against. I don't see how this change would fix an issue where we're borrowing the dom twice, unless an event is actively being handled while we process the hotpatch. That being said, I do see this issue pop up with use_resource so there might be an issue with the async polling and setting the runtime.

Do you have a more concrete repro I could work against to see what's actually happening here?

@tekacs
Copy link
Contributor Author

tekacs commented Dec 9, 2025

Hullo! I haven't seen an instance of this error pop up since I put this patch on the branch I use for dev.

It's been a moment since I opened this PR, but if I recall correctly, the gist is that hot patching is somehow happening while this RefCell in wasm-bindgen-futures is borrowed. You can see that in the panic on the first line:

wasm-bindgen-futures-0.4.54/src/task/singlethreadRefCell already borrowed

In my setup I'm likely spawning a lot more futures than a base Dioxus app, because I have various future loops (akin to setTimeout), which run forever. So it's almost a given that every few hot patches it'll panic like this.

As for the other PR – I would guess that any uses of Subsecond on WASM using futures would run into this issue, so I'm not certain that a Dioxus-specific fix is the way?

I can't pause to produce a repro right this second, but I suspect that this should show up very rapidly if trying to hot patch an app that creates a simple future loop with gloo's timers (really just setTimeout) or something akin. I'll try to supply a proper repro if I get a spare moment though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When hot patching on WASM, wasm_bindgen_futures cause RefCell: Already borrowed

2 participants