-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
panicked at 'already borrowed: BorrowMutError' #2562
Comments
How curious! Unfortunately I don't know how to set up a cloudflare environment or similar so the best I can offer is "debugging by reading code". Reading over this code I don't understand how this borrow can trip an error. Some questions I could ask are:
Otherwise if you could get a reproduction without cloudflare (e.g. in a browser or on node) I can help debug more. |
Hey @alexcrichton, apologies for the delay in getting back to you. Let me see if I can get that additional debug information you wanted and in the mean-time ask Cloudflare the question you asked. |
I can reliable reproduce this in a cloudflare worker as well @alexcrichton, how should I proceed to debug? |
Ok so I've managed to get a local build of wasm-bindgen-futures, compiling inside the cloudflare worker that's erroring. I've narrowed it down to this function
Calling the poll method, in my case makes it recursively call the
and because of this, @alexcrichton how should I proceed on fixing this? do you want me to give you the steps to reproduce inside a cloudflare worker? |
the error stack doesn't reveal much:
|
That certainly seems like something odd is happening with Cloudflare's JS runtime, because as far as I can tell that should be impossible with a normal JS runtime.
wasm-bindgen/crates/futures/src/queue.rs Line 81 in 3c1f5a9
That closure is then only ever used as a callback for wasm-bindgen/crates/futures/src/queue.rs Line 55 in 3c1f5a9
But, callbacks from
That should be helpful, particularly if it can be done locally using workerd. |
the reproduction I can come up with that shows the error: git clone https://github.com/samdenty/github-icons
cd api
wrangler dev Once it prompts, turn on local mode by pressing |
Interestingly enough sometimes I get this error:
|
This is also happening with the Deno runtime (V8). I'm also using
|
I can reproduce it, but there's also another panic unrelated to
So I think the issue in that case is that the task is panicking while the So I don't think that's really |
Hi 👋
Describe the Bug
I have found that under high load accessing Cloudflare KV and Cache API from Rust causes the following panic:
I already raised a issue with them on their cloudflare/rustwasm-worker-template, but they suggested you might be in a better place to help.
Steps to Reproduce
A sample project to reproduce this can be found cfw-borrowmuterror. The sample project has two endpoints:
/js
which fetches thefoo
key using just JavaScript/rs
which does the same, but using RustEXAMPLE_NS
on your accountEXAMPLE_NS
ensure thefoo
key exists, the value can be whatever you likecurl
to hit either the/js
or/rs
endpoint and ensure your value defined in (3) is returned.wrangler tail
to capture the logs from your deployed workerwrk
, for example:There are quite a few exceptions which do not generate useful logs, but if you are lucky:
Applying the same load to the
/js
endpoint always works. Only the/rs
endpoint exhibits the issue.I can see on L133:
...and would love to be able to dig further, but at the current limits of my knowledge on how to proceed. Any help gratefully received.
Expected Behavior
No panic occurs.
Actual Behavior
Under higher loads the following panic is observed:
The text was updated successfully, but these errors were encountered: