dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.95k stars 4.9k forks source link

.Net Core 2.2.207 error running on docker container #4497

Open jddm11 opened 4 years ago

jddm11 commented 4 years ago

Issue Title

.Net Core 2.2.207 error running on docker container

General

Hello everyone, I hope someone can give me an idea for this situation. I am running a docker container with the following DockerFile on Azure Web App for Containers (Linux):

# Microsoft .Net CORE image (Ubuntu 18.04)
FROM buildpack-deps:bionic-scm

# Install .NET CLI dependencies
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        libc6 \
        libgcc1 \
        libgssapi-krb5-2 \
        libicu60 \
        liblttng-ust0 \
        libssl1.0.0 \
        libstdc++6 \
        zlib1g \
        supervisor \
        dialog \
        openssh-server \
    && rm -rf /var/lib/apt/lists/* \    
    && echo "$SSH_PASSWD" | chpasswd 

COPY sshd_config /etc/ssh/
COPY init.sh /usr/local/bin/

# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.2.207

RUN curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
    && dotnet_sha512='9d70b4a8a63b66da90544087199a0f681d135bf90d43ca53b12ea97cc600a768b0a3d2f824cfe27bd3228e058b060c63319cd86033be8b8d27925283f99de958' \
    && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
    && mkdir -p /usr/share/dotnet \
    && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
    && rm dotnet.tar.gz \
    && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

# Configure web servers to bind to port 8181 when present
ENV ASPNETCORE_URLS="http://*:8181" \
    #ASPNETCORE_HTTPS_PORT=8181 \
    # Enable detection of running in a container
    DOTNET_RUNNING_IN_CONTAINER=true \
    # Enable correct mode for dotnet watch (only mode supported in a container)
    DOTNET_USE_POLLING_FILE_WATCHER=true \
    # Skip extraction of XML docs - generally not useful within an image/container - helps performance
    NUGET_XMLDOC_MODE=skip

....... 

When I run the .Net Core App (Not Docker) on a local environment (IIS) it works correctly, but when I run this on a container in Azure I got these errors (in an specific case that I explain below):

2020-04-01T16:59:51.861500120Z fail: Middleware[0]
2020-04-01T16:59:51.861628531Z       Unhandled exception in request pipeline: System.IO.IOException: The response ended prematurely.
2020-04-01T16:59:51.861635131Z          at System.Net.Http.HttpConnection.FillAsync()
2020-04-01T16:59:51.862598313Z          at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken)
2020-04-01T16:59:51.862612414Z          at Microsoft.Azure.AppService.MiddlewareShim.Startup.MergeFromClientMessage(HttpResponseMessage source, HttpResponse destination) in /EasyAuth/Middleware.Host/Startup.cs:line 260
2020-04-01T16:59:51.863150760Z          at Microsoft.Azure.AppService.MiddlewareShim.Startup.OnRequest(HttpContext context) in /EasyAuth/Middleware.Host/Startup.cs:line 158
2020-04-01T16:59:51.865571865Z fail: Microsoft.AspNetCore.Server.Kestrel[13]
2020-04-01T16:59:51.865600167Z       Connection id "0HLULV4F2B03J", Request id "0HLULV4F2B03J:00000001": An unhandled exception was thrown by the application.
2020-04-01T16:59:51.866379534Z System.IO.IOException: The response ended prematurely.
2020-04-01T16:59:51.866828572Z    at System.Net.Http.HttpConnection.FillAsync()
2020-04-01T16:59:51.866836372Z    at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken)
2020-04-01T16:59:51.866840073Z    at Microsoft.Azure.AppService.MiddlewareShim.Startup.MergeFromClientMessage(HttpResponseMessage source, HttpResponse destination) in /EasyAuth/Middleware.Host/Startup.cs:line 260
2020-04-01T16:59:51.866981385Z    at Microsoft.Azure.AppService.MiddlewareShim.Startup.OnRequest(HttpContext context) in /EasyAuth/Middleware.Host/Startup.cs:line 158
2020-04-01T16:59:51.866984785Z    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2020-04-01T16:59:51.886507939Z fail: Middleware[0]
2020-04-01T16:59:51.886522941Z       Unhandled exception in request pipeline: System.IO.IOException: The response ended prematurely.
2020-04-01T16:59:51.886527941Z          at System.Net.Http.HttpConnection.FillAsync()
2020-04-01T16:59:51.886682754Z          at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken)
2020-04-01T16:59:51.886689555Z          at Microsoft.Azure.AppService.MiddlewareShim.Startup.MergeFromClientMessage(HttpResponseMessage source, HttpResponse destination) in /EasyAuth/Middleware.Host/Startup.cs:line 260
2020-04-01T16:59:51.886693755Z          at Microsoft.Azure.AppService.MiddlewareShim.Startup.OnRequest(HttpContext context) in /EasyAuth/Middleware.Host/Startup.cs:line 158
2020-04-01T16:59:51.887612033Z fail: Microsoft.AspNetCore.Server.Kestrel[13]
2020-04-01T16:59:51.887624734Z       Connection id "0HLULV4F2B03K", Request id "0HLULV4F2B03K:00000001": An unhandled exception was thrown by the application.
2020-04-01T16:59:51.887629434Z System.IO.IOException: The response ended prematurely.
2020-04-01T16:59:51.887641835Z    at System.Net.Http.HttpConnection.FillAsync()
2020-04-01T16:59:51.887645936Z    at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.CopyToAsyncCore(Stream destination, CancellationToken cancellationToken)
2020-04-01T16:59:51.887813150Z    at Microsoft.Azure.AppService.MiddlewareShim.Startup.MergeFromClientMessage(HttpResponseMessage source, HttpResponse destination) in /EasyAuth/Middleware.Host/Startup.cs:line 260
2020-04-01T16:59:51.887819651Z    at Microsoft.Azure.AppService.MiddlewareShim.Startup.OnRequest(HttpContext context) in /EasyAuth/Middleware.Host/Startup.cs:line 158
2020-04-01T16:59:51.887823751Z    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

The application works ok until I use a feature that upload many files from the client. I noted that when I try to upload those files, for example if I sent 100 files (512 Kb each one) I got 73 on the server (I save the files in an images repository), it is not always the same result, sometimes I got 52 other time 85.

I have tried a reverse proxy to check if the problem is something related with kestrel but I got the same result.

Why this random behaviour? there is something special that have to configure in my .Net core project in order to run on a linux container?

Thank you

carlossanlop commented 4 years ago

@shirhatti

kanayabhattad commented 4 years ago

Any progress on it , facing same issue on Azure linux docker

mattcwebster commented 4 years ago

Im having same problem what the heck is wrong with this. Running a nodejs socket server works perfectly fine and then throwing this error when in Azure linux container... wth is wrong with this!

mattcwebster commented 4 years ago

does Azure Web apps for containers have a github I think it's related to Azure containers not dotnet as im experiencing same error in nodejs