Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpResponseMessage resulting in OutOfMemory writes guid values to response stream with 200 OK #4030

aarondandy opened this issue Jan 30, 2019 · 1 comment


Copy link

OutOfMemoryExceptions (assumed, could also be a timeout, no idea, lets just call it a failure) causes a guid to be written to the response buffer in the event of a failure along with an 200 OK response. This issue is not about an OOM error but is about the behaviors when an OOM occurs.

Investigative information

This seems to be related to the exception occurring after my function has completed as I return an HttpResponseMessage .

Repro steps

I am unable to reproduce this on my local machine but I can reproduce this on an S1.

using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;

namespace Yuge

public static class YugeResponse
    private static readonly HttpClient Client = new HttpClient
        Timeout = TimeSpan.FromMinutes(10)

    public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req)
        const string url = "";
        var source = await Client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
        var sourceContent = source.Content;
        var sourceStream = await sourceContent.ReadAsStreamAsync();

        var destinationContent = new StreamContent(sourceStream);
        destinationContent.Headers.ContentType = sourceContent.Headers.ContentType;
        destinationContent.Headers.ContentLength = sourceContent.Headers.ContentLength;

        return new HttpResponseMessage(HttpStatusCode.OK)
            Content = destinationContent


Expected behavior

I expect a request made to this resource to fail when memory limits are exceeded after the HttpResponseMessage is returned.

Actual behavior

The function returns an HTTP 200 OK with a guid value in the response body. Note that the OOM is not occurring within the function itself but after the function has returned. I have no idea what this guid is or where it comes from.

Known workarounds

I don't know of a workaround for this particular issue. I will open another issue related to the OOM I am experiencing.

Related information

Related information

  • Programming language used: C#
  • aspnetcore2.2
Copy link

aarondandy commented Oct 7, 2019

Now I seem to get 502 responses or blank 200 responses in Azure depending on planetary alignment 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant