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

Stack overflow crash when unknown route received #57

Closed
Soren025 opened this issue May 1, 2021 · 4 comments · Fixed by #81
Closed

Stack overflow crash when unknown route received #57

Soren025 opened this issue May 1, 2021 · 4 comments · Fixed by #81
Labels
fixed Issue was fixed or otherwise resolved.

Comments

@Soren025
Copy link

Soren025 commented May 1, 2021

Stack Trace

This happens with the sample project if you provide a route not defined. http://localhost:1234/asdfg for example.

This will also happen with the sample code shown in the project readme if the request is made in the browser. This is because the browser requests for the favicon.ico to which there is no route for that defined.

@danieletoffetti
Copy link

The problem is in RouterBaseExtensions.HandleHttpListenerExceptions, RouterBase.DefaultErrorHandler is not preserved, so the handler keeps calling itself. Easiest fix is to comment out rows 101-102 in RestServer.cs:
//if (Router is RouterBase)
// (Router as RouterBase).HandleHttpListenerExceptions();

Fix is only temporarily of course while the author (who did a great job by the way, I like Grapevine very much) posts a better one.

@scottoffen
Copy link
Owner

scottoffen commented May 21, 2021

Great catch! I'll check in a fix, but it might be a few days before I can get this into a nuget package.

As part of getting GV5 ready for an official release, I moved some things around to reduce package coupling and increase extensibility. Bugs were inevitable. :( Thanks for finding this and bringing it to my attention.

@scottoffen
Copy link
Owner

@Soren025 or @danieletoffetti would one of you mind verifying that this branch resolves your issue before I merge it in?
/~https://github.com/scottoffen/grapevine/tree/stack-overflow-crash

@danieletoffetti
Copy link

yes, issue is resolved with this fix. Nice, thanks!

@scottoffen scottoffen mentioned this issue Oct 3, 2021
@scottoffen scottoffen added the fixed Issue was fixed or otherwise resolved. label Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Issue was fixed or otherwise resolved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants