-
Notifications
You must be signed in to change notification settings - Fork 22
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
Causes 500 Error Page To Render Twice #65
Comments
I have no idea how a logging system like Sentry could cause something like this. Is there any further info you can pass on about this? Can you define exactly what "renders twice" means? Can you provide a screenshot please? What I'd do is as follows:
If the problem persists, it is unrelated to |
Hi. It took me a fair while to track the issue down to this plugin. I went through all my plugins and systematically removed and reinstalled them. This one was definitely the culprit. Not sure why/how but somehow it triggers Silverstripe to render the error-500 page twice before returning it as a response. I’ll get some screenshots tomorrow to show you what I mean. But essentially you can see what I mean by putting the site into live mode, and putting anything in the code that’ll trigger an error. I think I’ve got a demo repo knocking around too so I can send you a link to that. Thanks |
Is the error that's displayed in the screenshots, one that you think is caused by this module or something you're using to test the module with, by sending an "artificial" error to Sentry? If the latter, that's an "Error" which is an instance of To be a fair test, can you add If it's happening as a result of this module, then that's something altogether weird. In that case, I'll need all of the following:
Once I have those details, I can have a game stab at reproducing your setup. |
All I know is that when this plugin is installed I'm getting the error page rendering twice. I don't think this is anything to do with logging the exception to sentry ... I think it's something to do with how it's hooked in via monolog (or similar). I've not had time to dig into the code to see what it going on. I have added the |
I have shared my setup with you here: The install proceedure was via Silverstripes documentation:
PHP version is 7.4, as per the Docker file in the project, and Composer version is 2.0.9 |
Thanks for sharing the setup - but, while working on another project I noticed that I saw two error messages for an unrelated exception, and remembered your bug. I uninstalled the module and there it was, just one error message! Re-installing it, two again. But that's in "dev" mode. I set the project into "test" mode and there again, I saw the standard server-error page displayed twice! [CONFIRMED] Thank you for taking the time to provide all your details, I'll have a crack at fixing this as soon as I get some time. |
UPDATE: This does not occur in version 1.x of the module with Silverstripe 3.7. |
UPDATE: This occurs in the 3.x version of the module, and:
I thought that this may have something to do with Monolog's bubbling behaviour, but disabling this in |
This took some serious tracking down. Fixed in |
Seems I was a little hasty... |
Looks like |
I have dug into this and I'm convinced something's up with the Sentry package itself, or more likely how this module is using it. I've refactored the module a lot in v4 to make following logic easier. But I still cannot nail down where the problem really lies.
In a Dev environment, the both errors are actually different messages, but appear to result from the same exception. Next Steps: Re-install
|
Re-opening. It was auto-closed by GH |
I encountered this issue on a project (not using this module directly, but was using it for reference!) and found that it was caused by Sentry’s default listener integrations that are automatically activated. For me, the fix was to pass in the following option when creating the client:
|
Actually that option also removes the HTTP request info for example, so if you rely on that you might need to instead use the |
Had some contact with @kinglozzer on SilverStripe Users Slack. I've found out that the second "alert" (the one that I assume to trigger the second error-page) gets triggered when Tried to only disable this integrations to get HTTP request info inside the Sentry logs. |
I have noticed that the error that the module sends has user ID attached but does not have a stack trace, whereas the Sentry sent one does not have a user ID but does have a stack trace. Is that the same for others? |
i have the same issue and indeed i suspect that the default integration causes the error |
So after (quite) a bit of digging, turns out this is causing the issue Basically, sentry sdk is rethrowing the error after it has been logged Then, this is caught by Monolog's own ErrorHandler which, interestingly enough, changes its level along the way basically, i think it's down to the fact that silverstripe doesn't catch all exceptions and that the error-handler is handling things twice (once as a regular exception, once as a fatal error) and here is a little screenshot with the two records:
and if you are like me and that the "Uncaught Exception Exception" is driving you crazy (because, why "Exception Exception") this is due to |
One way of fixing this is to modify the HTTPOutputHandler as done here: silverstripe/silverstripe-framework@c26576b but since it's only causing issues when a third party module is installed, i'm not sure how willing the core team would be to merge this :) maybe @kinglozzer has an opinion on this ? |
Yeah I’m not sure it makes sense to work around this in core when it’s really only an issue with Sentry. I can’t remember this too clearly now, but it looks like we worked around this by just registering the integrations manually without the affected fatal/exception listeners: https://github.com/bigfork/silverstripe-sentry-handler/blob/master/src/SentryHubFactory.php#L39-L50 |
Silverstripe Framework Version: 4.7.2
Silverstripe Sentry Version: 3.0.7
When using this package it causes my 500 error pages to render twice, in dev this is hardly noticeable, however in production, when the friendly error page is shown then it leads to some interesting results of the error-500 page displaying twice stacked above each other.
The text was updated successfully, but these errors were encountered: