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
assertion failed: prev.start > max
on first invocation (without fs cache)
#3793
Comments
I'll try reproducing this from rust code.. |
Did this related to #2434 ? |
I don't think so, because it works after the first run (compilation) |
@theduke Hey, if you don't mind me asking if there is a chance that this can be fixed before 4.0? Lots of libraries are migrating to SWC and this bug might block some of the migrations. No pressure tho, totally understand that there is more important stuff to work on, cheers :) |
So, I reproduce the issue. I only reproduce it on Mac M1, not on Linux x64. I suspect this is the same issue as before. Is wasmer built with LTO there? That was the cause of the issue earlier. |
@ptitSeb I reproduce on Linux x64 on my side with styled components, superjson & lingui plugins. |
Can you detail of I can reproduce the issue localy @shouze ? |
@ptitSeb I'm not sure it can help unless I provide a minimal/simplified reproduction nextjs repo based on our nextjs app. I can just say that I cannot upgrade nextjs at the moment because of that on our app and that I have exactly the same wasmer bug. |
How do you build wasmer on you side? Can you remove some build optimisation to see if it "fixes" the issue? |
Unfortunately I don't build |
This is how Wasmer is integrated in the project: https://github.com/swc-project/swc/tree/v1.3.52/crates/swc_plugin_runner. At CosmWasm we are suffering the same panic after we upgraded from Wasmer 2 to Wasmer 3. We can reproduce it as follows:
We observe the error on M1 Macs as well as Windows. We'll test Linux more now but it seems less or not affected. Full Rust stack trace: CosmWasm/cosmwasm#1700 |
I am running the same tests with |
I have an almost minimal reproduction for this. This should make it much easier to look into, as it triggers it very quickly and reliably (at least on my M1 Macbook). |
@kdy1 @chipshort I have analyzed this and finaly understood the root cause of the issue. First, there is a PR not yet merge that improved EngineInner multi-thread robustness here: #4011 But trying this on your sample you'll see it doesn't fix the issue. That is because the sample create a new Engine for every thread. The issue is that, because each thread use a different engine instance, there is some inconsticencies beetwen code memory (some mmap memory) and the GlobalFrameInfo (a global structure registering all code memory used). When the Getting a fix for this doesn't seems trivial, and might have some performances issues. The workaround is to use a single Engine and clone it instead of creating a now one. Do you need 1 engine per thread on your usecase? |
cc @kwonoj |
Ok, I found a fix for the issue, you can now use and dispose multiple engine at once with PR #4011 . I still think you should reuse the same engine, it seems more ressouce efficient (unless each one has really different settings). |
Do you suggest one engine per Wasm module or just one engine globally for everything in the process? Since Engine owns the tunables this would limit users to one set of tunables. |
True. I would say recycle Engine as much as possible. |
We discovered another reason why we can't reuse the Engine easily. The metering middleware says it cannot be used from multiple modules
I.e. we need to use multiple engines with one compiler and one metering middleware each. Are we doing something wrong here? |
Ah, yes, metering. It makes sense to have different metering if you want to mesure different things. |
Describe the bug
swc-project/swc#7304
The Wasm plugin runner of SWC fails with an assertion failure.
Versions of wasmer & deps
rustc -vV
:Steps to reproduce
git clone https://github.com/await-ovo/reproduce-swc-plugins-crash-issue
cd reproduce-swc-plugins-crash-issue
pnpm i
RUST_BACKTRACE=1 node ./index.mjs
:Note that if you run it once again, it works. It happens again if you delete the fs cache (
.swc
directory)Expected behavior
It should not crash.
Actual behavior
It crashes on the first invocation.
Additional context
The author of the SWC issue uses
Also, this only happens if someone specify multiple plugins.
The text was updated successfully, but these errors were encountered: