Skip to content
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

Initial Memory Size #54

Open
ernst1j opened this issue Jun 14, 2024 · 4 comments
Open

Initial Memory Size #54

ernst1j opened this issue Jun 14, 2024 · 4 comments

Comments

@ernst1j
Copy link

ernst1j commented Jun 14, 2024

We have found an issue when loading large policies causing the Wasmtime to throw a "wasm trap: out of bounds memory access" error. We were able to pull in the source code into our project and change the minimum memory page size from 2 to 3 and that resolved our issue. We also tried updating the maximum memory size, but that did not seem to resolve the issue.

Unless we are doing something wrong, we would like to have an optional parameter on the CreatePolicyInstance to be able to specify the initial page size.

@christophwille
Copy link
Owner

I can add a ctor parameter for that; could you tell me actually which line raised the wasm trap (curiosity)?

@christophwille
Copy link
Owner

Does the change in the linked commit work for you?

@ernst1j
Copy link
Author

ernst1j commented Jun 17, 2024

@christophwille, yes that will work great. Thanks for the quick response.

@ernst1j
Copy link
Author

ernst1j commented Jun 17, 2024

FYI: This is my stack trace from the error: Wasmtime.TrapException: wasm trap: out of bounds memory access
at Wasmtime.Linker.Instantiate(Store store, Module module)
at Opa.Wasm.OpaPolicy.Initialize(Module module) in //src/Opa.Wasm/OpaPolicy.cs:line 119
at Opa.Wasm.OpaPolicy..ctor(Engine engine, Module module, IOpaSerializer serializer) in /
/src/Opa.Wasm/OpaPolicy.cs:line 48
at Opa.Wasm.OpaPolicyModule.CreatePolicyInstance(IOpaSerializer serializer) in /_/src/Opa.Wasm/OpaPolicyModule.cs:line 23

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

No branches or pull requests

2 participants