Thanks - I adapted the code so it fits my use case.
The issue persists which is unexpected for me.
I’ll involve a colleague of mine to make sure that I am not the problem here
/ I didn’t overlook an important aspect.
private void LaunchCompute()
{
var pathToRhinoCompute =
@"C:\Users\borstm\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.13\rhino.compute\rhino.compute.exe";
var startInfo = new ProcessStartInfo(pathToRhinoCompute);
int childCount = 3;
int thisProc = Process.GetCurrentProcess().Id;
startInfo.Arguments =
$"--childof {thisProc} --childcount {childCount} --port {8086} --spawn-on-startup";
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
// uncomment next line to ease debugging
// startInfo.WindowStyle = ProcessWindowStyle.Normal;
// Important: Keep UseShellExecute = true
// If UseShellExecute is false, the child process inherits file handles from
// the parent process. We found this out by noticing that Rhino suddenly thought
// all of it's files were read-only. If we want to go with UseShellExecute = false
// then we need to write a pInvoke to CreateProcess with the copyFileHandles
// set to false.
startInfo.UseShellExecute = true;
startInfo.CreateNoWindow = false;
string assemblyPath = Assembly.GetExecutingAssembly().Location;
// 6 April 2022 - S. Baer (COMPUTE-241)
// When grasshopper memory loads assemblies, the above line results in an
// empty string. In this case use the assemblyinfo location property.
//if (string.IsNullOrWhiteSpace(assemblyPath))
//{
// assemblyPath = GhaAssemblyInfo.TheAssemblyInfo.Location;
//}
//string parentPath = Path.GetDirectoryName(assemblyPath);
var wd =
@"C:\Users\borstm\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.13\rhino.compute";
startInfo.WorkingDirectory = wd;
var process = Process.Start(startInfo);
}
[14:02:43 INF] Rhino compute started at 9/10/2024 2:02:43 PM
[14:02:43 INF] Initiliazing reverse proxy at 9/10/2024 2:02:43 PM
[14:02:43 INF] Spawn children at startup is set to True
[14:02:43 INF] Now listening on: http://localhost:8086
[14:02:43 INF] Application started. Press Ctrl+C to shut down.
[14:02:43 INF] Hosting environment: Production
[14:02:43 INF] Content root path: C:\Users\borstm\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.13\rhino.compute
CG [14:02:47 INF] Child process started at 10.09.2024 14:02:47
CG [14:02:47 INF] Parsed port = 6003
CG [14:02:47 INF] Compute 8.0.0.0, Rhino 8.4.24044.15001
CG [14:02:52 INF] (1/3) Loading rhino scripting plugin
CG [14:02:52 INF] Successfully loaded scripting plugin
CG [14:02:52 INF] (2/3) Loading grasshopper
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pywin32_bootstrap'
CG [14:02:58 INF] (3/3) Loading compute plug-ins
CG [14:02:59 INF] Now listening on: http://localhost:6003
CG [14:02:59 INF] Application started. Press Ctrl+C to shut down.
CG [14:02:59 INF] Hosting environment: Production
CG [14:02:59 INF] Content root path: C:\Users\borstm\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.13\rhino.compute
CG [14:03:03 INF] Child process started at 10.09.2024 14:03:03
CG [14:03:03 INF] Parsed port = 6004
CG [14:03:03 INF] Compute 8.0.0.0, Rhino 8.4.24044.15001
CG [14:03:07 INF] Child process started at 10.09.2024 14:03:07
CG [14:03:07 INF] Parsed port = 6005
CG [14:03:07 INF] Compute 8.0.0.0, Rhino 8.4.24044.15001
CG [14:03:08 INF] (1/3) Loading rhino scripting plugin
CG [14:03:08 INF] Successfully loaded scripting plugin
CG [14:03:08 INF] (2/3) Loading grasshopper
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pywin32_bootstrap'
CG [14:03:12 INF] (1/3) Loading rhino scripting plugin
CG [14:03:12 INF] Successfully loaded scripting plugin
CG [14:03:12 INF] (2/3) Loading grasshopper
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pywin32_bootstrap'
CG [14:03:16 INF] (3/3) Loading compute plug-ins
CG [14:03:16 INF] Now listening on: http://localhost:6004
CG [14:03:16 INF] Application started. Press Ctrl+C to shut down.
CG [14:03:16 INF] Hosting environment: Production
CG [14:03:16 INF] Content root path: C:\Users\borstm\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.13\rhino.compute
CG [14:03:20 INF] (3/3) Loading compute plug-ins
CG [14:03:21 INF] Now listening on: http://localhost:6005
CG [14:03:21 INF] Application started. Press Ctrl+C to shut down.
CG [14:03:21 INF] Hosting environment: Production
CG [14:03:21 INF] Content root path: C:\Users\borstm\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\Hops\0.16.13\rhino.compute
[14:03:43 INF] Max concurrent requests = 1
CG [14:03:51 ERR] An exception occurred while processing request
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Rhino.Geometry.Collections.BrepFaceList.get_Item(Int32 index)
at Pufferfish.Components.Components_Surface._4_Surface.RebuildSurface.SolveInstance(IGH_DataAccess DA)
at Grasshopper.Kernel.GH_Component.Solution_Compute_MixedAccess(GH_StructureIterator it)
CG [14:03:51 ERR] An exception occurred while processing request
System.MissingMemberException: 'NoneType' object has no attribute 'PointAt'
at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at IronPython.Runtime.Binding.PythonGetMemberBinder.FastMethodGet`1.GetMethod(CallSite site, TSelfType target, CodeContext context)
at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at RhinoPython.PyCompiledCode.Execute(PythonScript scope) in D:\BuildAgent\work\dujour\src4\rhino4\Plug-ins\ironpython\core\Runtime.cs:line 177
at GhPython.Component.ScriptingAncestorComponent.SafeSolveInstance(IGH_DataAccess da)
CG [14:03:51 ERR] An exception occurred while processing request
System.MissingMemberException: 'NoneType' object has no attribute 'PointAt'
at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at IronPython.Runtime.Binding.PythonGetMemberBinder.FastMethodGet`1.GetMethod(CallSite site, TSelfType target, CodeContext context)
at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at RhinoPython.PyCompiledCode.Execute(PythonScript scope) in D:\BuildAgent\work\dujour\src4\rhino4\Plug-ins\ironpython\core\Runtime.cs:line 177
at GhPython.Component.ScriptingAncestorComponent.SafeSolveInstance(IGH_DataAccess da)
at Grasshopper.Kernel.GH_Component.Solution_Compute_MixedAccess(GH_StructureIterator it)
[14:04:43 INF] Max concurrent requests = 1
[14:05:18 ERR] HTTP POST /grasshopper responded 500 in 100042.3439 ms
System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at rhino.compute.ReverseProxyModule.SendProxyRequest(HttpRequest initialRequest, HttpMethod method, String baseurl) in D:\BuildAgent\work\4852f584398a78e4\src\rhino.compute\ReverseProxy.cs:line 146
at rhino.compute.ReverseProxyModule.ReverseProxyGrasshopper(HttpRequest req, HttpResponse res) in D:\BuildAgent\work\4852f584398a78e4\src\rhino.compute\ReverseProxy.cs:line 202
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
[14:05:18 ERR] Connection id "0HN6HI2DD2G82", Request id "0HN6HI2DD2G82:00000001": An unhandled exception was thrown by the application.
System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at rhino.compute.ReverseProxyModule.SendProxyRequest(HttpRequest initialRequest, HttpMethod method, String baseurl) in D:\BuildAgent\work\4852f584398a78e4\src\rhino.compute\ReverseProxy.cs:line 146
at rhino.compute.ReverseProxyModule.ReverseProxyGrasshopper(HttpRequest req, HttpResponse res) in D:\BuildAgent\work\4852f584398a78e4\src\rhino.compute\ReverseProxy.cs:line 202
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
[14:05:43 INF] Max concurrent requests = 1
[14:06:43 INF] Max concurrent requests = 0
[14:07:43 INF] Max concurrent requests = 0
[14:08:43 INF] Max concurrent requests = 0
[14:09:43 INF] Max concurrent requests = 0