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

Grow memory on demand in FastEvaluate #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

christophwille
Copy link
Owner

@christophwille christophwille commented Dec 25, 2024

Doesn't work yet

MemoryTests/large_input_host_and_guest_grow_successfully fails (copy of open-policy-agent/npm-opa-wasm@f1be838#diff-a7ab91d607d5a96793af6ae3d71f8ef6e71c6ff6255438c7281c2ab7182bcaafR58)

Used approach from existing PR #36 instead of porting the JS

Error:

opa_malloc: failed
  ----> System.Exception : opa_malloc: failed
  Stack Trace:
     at Wasmtime.Function.Invoke(Span`1 argumentsAndResults, StoreContext storeContext)
   at Wasmtime.Function.InvokeWithReturn[TR](Span`1 argsAndResults, IReturnTypeFactory`1 factory, StoreContext storeContext)
   at Wasmtime.Function.<>c__DisplayClass195_0`8.<WrapFunc>b__0(T1 p0, T2 p1, T3 p2, T4 p3, T5 p4, T6 p5, T7 p6)
   at Opa.Wasm.OpaPolicy.Policy_opa_eval(Int32 entrypoint_id, Int32 dataaddr, Int32 jsonaddr, Int32 jsonlength, Int32 heapaddr) in /_/src/Opa.Wasm/OpaPolicy.Functions.cs:line 77
   at Opa.Wasm.OpaPolicy.FastEvaluate(String json, Nullable`1 entrypoint) in /_/src/Opa.Wasm/OpaPolicy.cs:line 320
   at Opa.Wasm.OpaPolicy.ExecuteEvaluate(String json, Nullable`1 entrypoint, Boolean disableFastEvaluate) in /_/src/Opa.Wasm/OpaPolicy.cs:line 283
   at Opa.Wasm.OpaPolicy.EvaluateJson(String json, Boolean disableFastEvaluate) in /_/src/Opa.Wasm/OpaPolicy.cs:line 234
   at Opa.Wasm.UnitTests.MemoryTests.large_input_host_and_guest_grow_successfully() in /home/runner/work/dotnet-opa-wasm/dotnet-opa-wasm/src/Opa.Wasm.UnitTests/MemoryTests.cs:line 38
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--Exception
   at Opa.Wasm.OpaPolicy.<LinkImports>b__29_0(Caller caller, Int32 addr) in /_/src/Opa.Wasm/OpaPolicy.cs:line 85
   at Wasmtime.Function.<>c__DisplayClass106_0`1.<FromCallback>b__0(IntPtr env, IntPtr callerPtr, ValueRaw* args_and_results, UIntPtr num_args_and_results)

@christophwille
Copy link
Owner Author

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

Successfully merging this pull request may close these issues.

1 participant