Rhino Compute - Python API Error

unhandled
#1

I am spinning up compute locally from the latest commit on the master branch.
When using python’s compute_rhino3d I get an error in NancyPipelineExtensions.cs

The error is

" [Cannot access a closed Stream] at System.IO.__Error.StreamIsClosed() at System.IO.MemoryStream.get_Length() at compute.frontend.RequestLogEnricher.Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) \\compute.rhino3d\\src\\compute.frontend\\NancyPipelineExtensions.cs:line 149\r\n at Serilog.Core.Logger.Dispatch(LogEvent logEvent)"

Wrapping this in a try-catch block bypasses the problem for now…

var stream = new MemoryStream();
try
{
	ctx.Response.Contents.Invoke(stream);
	logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
		"ResponseContentLength", stream.Length));
}
catch
{
	stream.Dispose();
}
0 Likes

(Steve Baer) #3

@will or @brian, have you seen this behavior with the logging code? I’m not too familiar with it.

0 Likes

(Will Pearson) #4

Hey Sherif, I have seen this very occasionally, but only while testing locally. If you open a pull request with your fix I’ll get it merged :+1:

0 Likes

(Steve Baer) #5

Do we actually understand what is happening here? I would rather not mask a problem with a try/catch block.

0 Likes