Skip to content

Events are not sent in AWS Lambda (ASP.NET Core Web API) .  #215

Closed

Description

@hmvs

Hi guys.

As far as AWS lambda freezes all background threads right after returning results, exceptionless is not working, seems to be because of Timers also get frozen.

 [
  {
    "date": "2019-08-19T14:47:33.2301596+00:00",
    "level": {
      "name": "Trace",
      "ordinal": 0
    },
    "source": "DefaultEventQueue",
    "message": "Processing queue...",
    "exception": null
  },
  {
    "date": "2019-08-19T14:47:23.0338945+00:00",
    "level": {
      "name": "Info",
      "ordinal": 2
    },
    "source": "DefaultEventQueue",
    "message": "Sent 1 events to \"https://collector.exceptionless.io\".",
    "exception": null
  },
  {
    "date": "2019-08-19T14:43:09.9984337+00:00",
    "level": {
      "name": "Trace",
      "ordinal": 0
    },
    "source": "DefaultEventQueue",
    "message": "Processing queue...",
    "exception": null
  },
  {
    "date": "2019-08-19T14:42:43.3919108+00:00",
    "level": {
      "name": "Trace",
      "ordinal": 0
    },
    "source": "ExceptionlessClient",
    "message": "Submitting event: type=log",
    "exception": null
  },
  {
    "date": "2019-08-19T14:42:43.3906358+00:00",
    "level": {
      "name": "Trace",
      "ordinal": 0
    },
    "source": "DuplicateCheckerPlugin",
    "message": "Enqueueing event with hash: 5055887 to cache.",
    "exception": null
  },
  {
    "date": "2019-08-19T14:42:43.3903982+00:00",
    "level": {
      "name": "Trace",
      "ordinal": 0
    },
    "source": "DuplicateCheckerPlugin",
    "message": "Checking event: Unknown error responding to request: InvalidOperationException:\nSystem.InvalidOperationException: It is our exception that we throw to test\n   at My.Api.Controllers.ValuesController.Get(Int32 id) with hash: 5055887",
    "exception": null
  },
  {
    "date": "2019-08-19T14:42:41.9262751+00:00",
    "level": {
      "name": "Trace",
      "ordinal": 0
    },
    "source": "DefaultEventQueue",
    "message": "Processing queue...",
    "exception": null
  }
]


2019-08-19T14:47:23.0338945+00:00 I invoked Lambda with a parameter that triggers ProcessQueue() method.

See: related

Activity

  1. changed the title [-]AWS Lambda ASP.NET Web API Exceptionless not working.[/-] [+]Events are not sent AWS Lambda (ASP.NET Core Web API) . [/+] on Aug 19, 2019
  2. changed the title [-]Events are not sent AWS Lambda (ASP.NET Core Web API) . [/-] [+]Events are not sent in AWS Lambda (ASP.NET Core Web API) . [/+] on Aug 19, 2019
  3. niemyjski commented on Aug 19, 2019

    @niemyjski
    Member

    You could call ProcessQueue inside of here:

    context.Response.OnCompleted(() =>
    {
    // Perform slow code here.
    return Task.CompletedTask;
    });

    or on the last line of your function. Did that solve it?

  4. hmvs commented on Aug 20, 2019

    @hmvs
    Author

    I've tried these two variants. Both of them responds only when the whole code executes, including part in OnCompleted block.

    [HttpGet("{id}")]
    public IActionResult Get(int id) {
    	this.HttpContext.Response.OnCompleted(() => {
    	     Startup.ExceptionlessClient.ProcessQueue();
    	     for (long i = 0; i <= 8000000000; i++) {
    	     }
    	return Task.CompletedTask;
         });	
         return Ok("exit ok");
    }
    
    [HttpGet("{id}")]
    public IActionResult Get(int id) {
    	this.HttpContext.Response.OnCompleted(() => {
    		return Task.WhenAll(Startup.ExceptionlessClient.ProcessQueueAsync(), Task.Delay(20000));
    		});
    return Ok("exit ok");
    }
    
  5. niemyjski commented on Sep 20, 2019

    @niemyjski
    Member

    The inner for loop won't do anything because the compiler will remove it. You'd be better to just call ProcessQueueAsync and await it otherwise a deadlock could occur. Were you able to get any further on this issue?

  6. niemyjski commented on Jan 16, 2020

    @niemyjski
    Member

    Were you able to get any further on this issue?

  7. hmvs commented on Feb 20, 2020

    @hmvs
    Author

    Unfortunately, no. Just thought we need some very lightweight client.

  8. niemyjski commented on Jan 4, 2021

    @niemyjski
    Member

    What happens if you call ExceptionlessClient.Default.Startup() in your app. Does it always report the events?

  9. niemyjski commented on Jan 10, 2021

    @niemyjski
    Member

    We just made some huge improvements to our ASP.NET Core client to better support functions. Can you please upgrade to https://github.com/exceptionless/Exceptionless.Net/releases/tag/v4.6.2 and let us know if you run into any issues.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions