runtime: Random build/restore/publish errors on docker. (returned a non-zero code: 139)

From @djsowa on September 25, 2017 20:0

Steps to reproduce

FROM microsoft/dotnet:2.0-sdk

# Set working dir or docker to /app
WORKDIR /app

RUN dotnet --info
# Restore code dependecies - packages will be downloaded.
RUN dotnet new console -o ./src
RUN dotnet restore ./src --disable-parallel -v diag

# publish application(build included) into /app directory

RUN dotnet build ./src -v diag
RUN dotnet publish ./src --output /app -v diag

# run console application on docker.
ENTRYPOINT ["dotnet"]

Expected behavior

Build succesfully

Actual behavior

I’m receiving random errors, some times error occur on restore, sometimes on build and sometime on publish step, now(update) occurred even on dotnet new step.

Restore:

Service ‘NAME’ failed to build: The command ‘/bin/sh -c dotnet restore ./src --disable-parallel -v diag’ returned a non-zero code: 139

Build:

Service ‘NAME’ failed to build: The command ‘/bin/sh -c dotnet build ./src’ returned a non-zero code: 139

New:

The command ‘/bin/sh -c dotnet new console -o /app/src’ returned a non-zero code: 139

Diagnostic logs

Environment data

RUN dotnet --info
 ---> Running in 6b2d67b6fcd6
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Copied from original issue: dotnet/cli#7706

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 33 (17 by maintainers)

Most upvoted comments

This might be of help to someone, not quote the same error but I was getting

/usr/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.mvc.razor.viewcompilation/2.0.0/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets(60,5): error MSB3073: The command “”/usr/share/dotnet/dotnet" exec --runtimeconfig “/var/www/mycarparks/MyCarparks.Web/bin/Debug/netcoreapp2.0/MyCarparks.Web.runtimeconfig.json” --depsfile “/var/www/mycarparks/MyCarparks.Web/bin/Debug/netcoreapp2.0/MyCarparks.Web.deps.json” “/usr/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.mvc.razor.viewcompilation/2.0.0/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll” @“obj/Debug/netcoreapp2.0/microsoft.aspnetcore.mvc.razor.viewcompilation.rsp”" exited with code 137. [/var/www/mycarparks/MyCarparks.Web/MyCarparks.Web.csproj]

on an Ubuntu-16.04 server with DigitalOcean 512MB/1CPU, I googled just the exit code (137) which led me to an out of memory exception

I upgraded to 1GB/1CPU server and retried the build and it worked

Yup, just saw csc a bunch of times and wanted to make sure you were aware and could correlate if you see other similar issues.