Comments (9)
Do you have any tight loops that run many, many times that create anything in CML? We've enabled weakrefs in wasm/js which are supposed to be freed automatically when they go out of scope but I think JS gets behind on this sometimes so anywhere that is creating lots of the same struct you might want to explicitly call free().
When I tested this I had the tx builder create millions of transactions in a loop and it'd get out of memory after I think 500k if I had it in a regular loop, but if I put some pauses in it it'd still eventually run out of memory but usually not until after many millions. The more pause I gave it the less likely it was to do that but it'd still tend to happen when I was doing it with like 50k iterations before pausing.
And are you sure nothing in JS is maintaining references to any of these wasm structs? That would stop it from being automatically GC'd too. I'm not sure if it's smart enough to detect things that reference each other and nothing else or if it just counts refs but it could be the latter.
from cardano-multiplatform-lib.
I have implemented a retry loop in case the transaction fails, but it is currently configured for only four attempts, with exponential delays of 20 seconds.
Now, I have made the following updates:
Updated CML to version 5.3.
Upgraded vitest to version 1.6.0.
Updated Node.js to version 21.6.2.
and I get this error...
@lucid-evolution/lucid:test: Error: recursive use of an object detected which would lead to unsafe aliasing in rust
@lucid-evolution/lucid:test: ❯ module.exports.__wbindgen_throw ../../node_modules/.pnpm/@[email protected]/node_modules/@dcspark/cardano-multiplatform-lib-nodejs/cardano_multiplatform_lib.js:37518:11
@lucid-evolution/lucid:test: ❯ null.<anonymous> wasm:/wasm/00a747c2:1:2501206
@lucid-evolution/lucid:test: ❯ null.<anonymous> wasm:/wasm/00a747c2:1:2501220
@lucid-evolution/lucid:test: ❯ null.<anonymous> wasm:/wasm/00a747c2:1:2212507
@lucid-evolution/lucid:test: ❯ null.<anonymous> wasm:/wasm/00a747c2:1:2034126
@lucid-evolution/lucid:test: ❯ null.<anonymous> wasm:/wasm/00a747c2:1:2231337
@lucid-evolution/lucid:test: ❯ ../../node_modules/.pnpm/@[email protected]/node_modules/@dcspark/cardano-multiplatform-lib-nodejs/cardano_multiplatform_lib.js:11219:70
@lucid-evolution/lucid:test:
@lucid-evolution/lucid:test: This error originated in "test/hello.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
@lucid-evolution/lucid:test: The latest test that might've caused the error is "CollectFunds". It might mean one of the following:
@lucid-evolution/lucid:test: - The error was thrown, while Vitest was running this test.
@lucid-evolution/lucid:test: - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
I think this error relates to this? rustwasm/wasm-bindgen#1578
Error: recursive use of an object detected which would lead to unsafe aliasing in rust
from cardano-multiplatform-lib.
Is it possible to return more information when an error occurs, like using something such as https://github.com/rustwasm/console_error_panic_hook , @rooooooooob ?
from cardano-multiplatform-lib.
I'm also wondering if CML is using the latest https://github.com/rustwasm/wasm-bindgen/releases/tag/0.2.92 , @rooooooooob ?
from cardano-multiplatform-lib.
I think the problem has to do with DatumOption, for some reason when I free() DatumOption
it returns this error Error: null pointer passed to rust'
However when I remove free() , this error keeps coming back
from cardano-multiplatform-lib.
@rooooooooob @SebastienGllmt I managed to fix the error by manipulating the file. node_modules/.pnpm/@[email protected]/node_modules/@dcspark/cardano-multiplatform-lib-nodejs/cardano_multiplatform_lib.js
I commented out these 2 lines
DatumOptionFinalization.register(obj, obj.ptr, obj);
DatumOptionFinalization.unregister(this);
My question is, can we disable them on demand?
from cardano-multiplatform-lib.
That code is generated by wasm-pack tooling. Unless you create a script to modify the CML outputs, you would have to go make a PR to the underlying wasm pack library
from cardano-multiplatform-lib.
I've noticed that when I replaced TransactionOutput.new(...)
with TransactionOutputBuilder.new()
, the error no longer occurred.
I'll continue testing, and perhaps TransactionOutput.new
should be deprecated or completely replaced by TransactionOutputBuilder
.
from cardano-multiplatform-lib.
I think I can close this, I've been testing the TransactionOutputBuilder.new()
without any issues at all
from cardano-multiplatform-lib.
Related Issues (20)
- Missing WASM address exports
- Missing WASM TransactionUnspentOutputs export? HOT 4
- Missing WASM PlutusScriptWitness constructor HOT 5
- Rename `BigInt` to something else
- Replace `as_` functions in Rust with `From` / `TryFrom`
- Missing `NetworkInfo` in WASM
- Cannot verify signature HOT 1
- TransactionHash Mistmatch HOT 4
- Byron block hash wrong
- ByronBlock / MultiEraBlock explicit era tag HOT 1
- Need help HOT 2
- Error: null pointer passed to rust HOT 1
- Add token information to transaction balance errors
- Conway Proposing/Voting RedeemerTag builder update
- Crash on duplicate key in mint on preprod
- cml_chain::NonemptySetPlutusData.json: RangeError: Maximum call stack size exceeded
- nodejs: AssetName class missing `to_hex()` method
- Getting minUtxo error for ada deducted by wallet HOT 1
- Missing methods TransactionUnspentOutput HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cardano-multiplatform-lib.