ashmind / SharpLab

.NET language playground
https://sharplab.io
BSD 2-Clause "Simplified" License
2.72k stars 199 forks source link

SharpLab.Container.Manager.Internal.ContainerAllocationException: Failed to allocate container within 5 seconds. #1128

Open venliong opened 2 years ago

venliong commented 2 years ago

I'd setup SharpLab by setup.ps1, but when I run SharpLab by dotnet tye run --watch, code run result cannot write to output pipe. Is there something I missed?

/*
  SharpLab tools in Run mode:
    • value.Inspect()
    • Inspect.Heap(object)
    • Inspect.Stack(value)
    • Inspect.MemoryGraph(value1, value2, …)
*/
using System;

Console.WriteLine("🌄");
System.Exception: Container host reported an error:
SharpLab.Container.Manager.Internal.ContainerAllocationException: Failed to allocate container within 5 seconds.
 ---> System.IO.IOException: Pipe is broken.
   at System.IO.Pipes.PipeStream.WriteCore(ReadOnlySpan`1 buffer)
   at System.IO.Pipes.PipeStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at ProtoBuf.ProtoWriter.StreamProtoWriter.TryFlush(State& state) in /_/src/protobuf-net.Core/ProtoWriter.Stream.cs:line 94
   at ProtoBuf.ProtoWriter.StreamProtoWriter.ImplEndLengthPrefixedSubItem(State& state, SubItemToken token, PrefixStyle style) in /_/src/protobuf-net.Core/ProtoWriter.Stream.cs:line 409
   at ProtoBuf.ProtoWriter.State.EndSubItem(SubItemToken token, PrefixStyle style) in /_/src/protobuf-net.Core/ProtoWriter.State.WriteMethods.cs:line 784
   at ProtoBuf.ProtoWriter.State.WriteObject(Object value, Type type, PrefixStyle style, Int32 fieldNumber) in /_/src/protobuf-net.Core/ProtoWriter.State.WriteMethods.cs:line 709
   at ProtoBuf.Meta.TypeModel.SerializeWithLengthPrefix(Stream dest, Object value, Type type, PrefixStyle style, Int32 fieldNumber, SerializationContext context) in /_/src/protobuf-net.Core/Meta/TypeModel.cs:line 675
   at ProtoBuf.Meta.TypeModel.SerializeWithLengthPrefix(Stream dest, Object value, Type type, PrefixStyle style, Int32 fieldNumber) in /_/src/protobuf-net.Core/Meta/TypeModel.cs:line 640
   at ProtoBuf.Serializer.SerializeWithLengthPrefix[T](Stream destination, T instance, PrefixStyle style, Int32 fieldNumber) in /_/src/protobuf-net/Serializer.Serialize.cs:line 133
   at ProtoBuf.Serializer.SerializeWithLengthPrefix[T](Stream destination, T instance, PrefixStyle style) in /_/src/protobuf-net/Serializer.Serialize.cs:line 117
   at SharpLab.Container.Manager.Internal.StdinWriter.WriteCommand(Stream stream, StdinCommand command) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Container.Manager\Internal\StdinWriter.cs:line 10
   at SharpLab.Container.Manager.Internal.ExecutionProcessor.ExecuteInContainerAsync(ActiveContainer container, Byte[] assemblyBytes, Byte[] outputBufferBytes, Boolean includePerformance, Boolean isWarmup, CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Container.Manager\Internal\ExecutionProcessor.cs:line 28
   at SharpLab.Container.Manager.Internal.ContainerAllocationWorker.CreateAndStartContainerAsync(CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Container.Manager\Internal\ContainerAllocationWorker.cs:line 72
   at SharpLab.Container.Manager.Internal.ContainerAllocationWorker.ExecuteAsync(CancellationToken stoppingToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Container.Manager\Internal\ContainerAllocationWorker.cs:line 46
   --- End of inner exception stack trace ---
   at SharpLab.Container.Manager.Internal.ExecutionManager.ExecuteAsync(String sessionId, Byte[] assemblyBytes, Byte[] outputBufferBytes, Boolean includePerformance, CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Container.Manager\Internal\ExecutionManager.cs:line 42
   at SharpLab.Container.Manager.Endpoints.ExecutionEndpoint.ExecuteAsync(HttpContext context) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Container.Manager\Endpoints\ExecutionEndpoint.cs:line 58
   at SharpLab.Server.Execution.Container.ContainerClient.ExecuteAsync(String sessionId, Stream assemblyStream, Boolean includePerformance, CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Server\Execution\Container\ContainerClient.cs:line 33
   at SharpLab.Server.Execution.ContainerExecutor.ExecuteAsync(CompilationStreamPair streams, IWorkSession session, CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Server\Execution\ContainerExecutor.cs:line 62
   at SharpLab.Server.MirrorSharp.SlowUpdate.ProcessAsync(IWorkSession session, IList`1 diagnostics, CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\Server\MirrorSharp\SlowUpdate.cs:line 114
   at MirrorSharp.Internal.Handlers.SlowUpdateHandler.ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\#external\mirrorsharp\Common\Internal\Handlers\SlowUpdateHandler.cs:line 31
   at MirrorSharp.Internal.Connection.ReceiveAndProcessInternalAsync(CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\#external\mirrorsharp\Common\Internal\Connection.cs:line 96
   at MirrorSharp.Internal.Connection.ReceiveAndProcessAsync(CancellationToken cancellationToken) in C:\share\dev.azure.com\ruanjimu\SharpLab\source\#external\mirrorsharp\Common\Internal\Connection.cs:line 54
ashmind commented 2 years ago

Thanks for reporting! Can you check if this workaround by @htranou works for you? https://github.com/ashmind/SharpLab/issues/886#issuecomment-1003378797

(I will take a look at proper fix eventually, but haven't got to it quite yet)

ashmind commented 2 years ago

This might now be fixed -- please retry sl setup to check again.