mcneel / compute.rhino3d

REST geometry server based on RhinoCommon and headless Rhino
Other
301 stars 189 forks source link

Compute crashing - "Attempted to read or write protected memory" #551

Open mdjaere opened 2 years ago

mdjaere commented 2 years ago

Rhino compute crashes while attempting to run a medium sized grasshopper definition. Rhino compute is running in a docker container on an EC2 unit. The definition solves without issues on the same instance using grasshopper manually in about 10 seconds.

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at UnsafeNativeMethods.ON_Mesh_NonConstBoolOp(IntPtr ptr, MeshNonConstBoolConst which)
   at SurfaceComponents.MeshComponents.Component_MeshFaceNormals.SolveInstance(IGH_DataAccess DA)
   at Grasshopper.Kernel.GH_Component.Solution_Compute_MixedAccess(GH_StructureIterator it)
   at Grasshopper.Kernel.GH_Component.ComputeData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.Parameters.Param_GenericObject.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.Parameters.Param_GenericObject.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.Parameters.Param_GenericObject.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Component.CollectData()
   at Grasshopper.Kernel.GH_Document.SolveAllObjects(GH_SolutionMode mode)
   at Grasshopper.Kernel.GH_Document.NewSolution(Boolean expireAllObjects, GH_SolutionMode mode)
   at Grasshopper.Kernel.Special.GH_Cluster.SolveInstance(IGH_DataAccess DA)
   at Grasshopper.Kernel.GH_Component.Solution_Compute_MixedAccess(GH_StructureIterator it)
   at Grasshopper.Kernel.GH_Component.ComputeData()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Param`1.CollectVolatileData_FromSources()
   at Grasshopper.Kernel.GH_Param`1.CollectData()
   at Grasshopper.Kernel.GH_Document.SolveAllObjects(GH_SolutionMode mode)
   at Grasshopper.Kernel.GH_Document.NewSolution(Boolean expireAllObjects, GH_SolutionMode mode)
   at compute.geometry.GrasshopperDefinition.Solve() in C:\src\compute.geometry\GrasshopperDefinition.cs:line 749
   at compute.geometry.ResthopperEndpointsModule.GrasshopperSolveHelper(Schema input, String body, Stopwatch stopwatch) in C:\src\compute.geometry\ResthopperEndpoints.cs:line 116
   at compute.geometry.ResthopperEndpointsModule.Grasshopper(NancyContext ctx) in C:\src\compute.geometry\ResthopperEndpoints.cs:line 172
   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)
   at Nancy.Routing.Route.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)
   at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, CancellationToken cancellationToken, DynamicDictionary parameters, NancyContext context)
   at Nancy.Routing.DefaultRequestDispatcher.<>c__DisplayClass2.<Dispatch>b__0(Task`1 completedTask)
   at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context, CancellationToken cancellationToken)
   at Nancy.NancyEngine.<>c__DisplayClasse.<InvokeRequestLifeCycle>b__c(Task`1 t)
   at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, CancellationToken cancellationToken, IPipelines pipelines)
   at Nancy.NancyEngine.HandleRequest(Request request, Func`2 preRequest, CancellationToken cancellationToken)
   at Nancy.NancyEngineExtensions.HandleRequest(INancyEngine nancyEngine, Request request, Func`2 preRequest, Action`1 onComplete, Action`1 onError, CancellationToken cancellationToken)
   at Nancy.Owin.NancyMiddleware.<>c__DisplayClass4.<>c__DisplayClass6.<UseNancy>b__1(IDictionary`2 environment)
   at compute.geometry.LoggingMiddleware.<Invoke>d__1.MoveNext() in C:\src\compute.geometry\Startup.cs:line 33
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at compute.geometry.LoggingMiddleware.Invoke(IOwinContext ctx)
   at Microsoft.Owin.Cors.CorsMiddleware.<Invoke>d__4.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Cors.CorsMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Hosting.Utilities.Encapsulate.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Host.HttpListener.OwinHttpListener.<ProcessRequestAsync>d__30.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Host.HttpListener.OwinHttpListener.ProcessRequestAsync(HttpListenerContext context)
   at Microsoft.Owin.Host.HttpListener.OwinHttpListener.<ProcessRequestsAsync>d__29.MoveNext()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
   at System.Threading.Tasks.TaskFactory`1.<>c__DisplayClass35_0.<FromAsyncImpl>b__0(IAsyncResult iar)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.ListenerAsyncResult.IOCompleted(ListenerAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
sbaer commented 2 years ago

Can you repeat this crash by testing your definition with Hops in a desktop environment?

We would need the definition to be able to do any debugging.