Skip to content

Grow memory on demand in FastEvaluate#58

Open
christophwille wants to merge 1 commit intomasterfrom
feature/growmemory
Open

Grow memory on demand in FastEvaluate#58
christophwille wants to merge 1 commit intomasterfrom
feature/growmemory

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