FubuMvcArchive / FubuMVC.ServerSentEvents

Server sent events for your FubuMVC application
3 stars 2 forks source link

Stack overflow exception fix #6

Closed mtscout6 closed 12 years ago

mtscout6 commented 12 years ago

Due to the TackCreationOptions.AttachToParent and our use of recursive method calls there was the potential of a StackOverflowException. This was not easily apparent since each task has it's own stack, however when all the tasks complete on a client disconnect that is when the StackOverflowException would occur.

At the same time though I didn't want to introduce any wait handles. So, to keep the request alive I added a TaskCompletionSource that IS attached to the parent that isn't set until the client disconnects, the channel disconnects, or an exception is thrown. In the event of an exception the TaskCompletionSource has the exception appended to it and exception logging is still handled in the AsyncInterceptExceptionBehavior.