Giter VIP home page Giter VIP logo

Comments (9)

rooooooooob avatar rooooooooob commented on July 18, 2024

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.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

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.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

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.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

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.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

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
image

from cardano-multiplatform-lib.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

@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?

image

from cardano-multiplatform-lib.

SebastienGllmt avatar SebastienGllmt commented on July 18, 2024

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.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

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.

solidsnakedev avatar solidsnakedev commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.