Bod has asked for the wisdom of the Perl Monks concerning the following question:
This is a follow on from the second part of the question I asked in CGI::Carp fatalsToFile
The collective wisdom of The Monastery solved the first issue but not the second...it seems they are unrelated!
I am getting 500 errors intermittently from most, if not all of the pages of a website. The errors seems to be clumped together over time. In other words, once an error happens it seems likely that it will happen again quite soon. Whereas at other times we go quite a while without errors.
Every script has use CGI::Carp qw(fatalsToBrowser); at the start of the script.
The bit I am most confused about is that my understanding is that, with fatalsToBrowser the only two ways to get a 500 error is that the script has the wrong permissions or that the script doesn't return valid HTTP headers. As this is an intermittent problem, it is neither of these.
This is the code of the modules that are common :
andpackage Site::HTML; use strict; use warnings; use DBI; #use DBD::mysql; use Exporter; use Template; use MIME::Lite; use Digest::SHA qw(sha256_base64); use cPanelUserConfig; use Site::Variables; use Bod::CRM; our @ISA = qw(Exporter); our @EXPORT = qw(%data %file %cookie $dbh $current_user); our $site = $Site::Variables::site; our $template = Template->new( INCLUDE_PATH => $Site::Variables::template_path, PRE_CHOMP => 0, POST_CHOMP => 1, ); our (%data, %file, %cookie, $dbh); our $current_user = 0; my $crm = Bod::CRM->new($Site::Variables::env_crm_env); # Untaint ENV{PATH} for MIME::Lite my $path = $ENV{'PATH'}; $ENV{'PATH'} = undef; foreach my $p(split /:/, $path) { if ($p =~ m!^(/(usr|bin).*)!) { $ENV{'PATH'} .= ':' if $ENV{'PATH'}; $ENV{'PATH'} .= $1; } }
I have commented out use DBD::mysql; because on one occasion I got some output from CGI::Carp that showed an error on that line. I have not been able to replicate this error. Not specifying a DBD driver forces DBI::DBD to use the driver in it's config which is setup to connect to the MariaDB database.package Site::Wayfinder; use strict; use warnings; use cPanelUserConfig; use Digest::SHA qw(sha512_base64); use Facebook::Graph; use GD; use Bod::CRM; use Site::HTML; use Site::Point; my $crm = Bod::CRM->new(Site::HTML->crm_env); sub new { my $class = shift; my %attrs = @_; $attrs{'error'} = ''; $attrs{'fb'} = Facebook::Graph->new( app_id => '12345678', secret => 'abcdefghijklmnop', postback => "https://$ENV{'HTTP_HOST'}/?command=authori +ze_facebook", ); return bless \%attrs, $class; }
My only hunch is that, because errors seem more concentrated at certain times, it is connected with the number of concurrent users. This in turn makes me wonder if is is Facebook::Graph that is the problem as it is deprecated. We only use Facebook for authentication. Users can create an account using Facebook rather than creating a password or can sign into an existing account using Facebook provided the email addresses are the same. This works under normal circumstances.
It isn't just web browsers that are getting the error. Facebook is complaining that our privacy policy page is giving errors and Stripe gets occasion webhook errors.
I am unable to replicate the problem on our test site - it only seems to happen on the live production site. Therefore I am limited on how much I can test or what I can tweak!
Any ideas what I can do to try and get some understanding of what is going on?
UPDATE: - to test my hunch that it is to do with multiple users, I have tried to cross referencer 500 errors with the data collected by Google Analytics and Hotjar. But the errors are not written to the Apache error log so this is proving difficult. I have started having Google Analytics open when I access the site so that I can look at the real time data when I next see an error.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Errors uncaught by CGI::Carp
by hippo (Bishop) on Oct 13, 2021 at 22:51 UTC | |
by Bod (Parson) on Oct 15, 2021 at 23:11 UTC | |
by Bod (Parson) on Oct 14, 2021 at 17:30 UTC | |
by hippo (Bishop) on Oct 14, 2021 at 21:42 UTC | |
by Bod (Parson) on Oct 14, 2021 at 22:01 UTC | |
by Bod (Parson) on Oct 14, 2021 at 22:38 UTC | |
by hippo (Bishop) on Oct 15, 2021 at 08:32 UTC | |
Re: Errors uncaught by CGI::Carp
by Bod (Parson) on Oct 14, 2021 at 20:15 UTC | |
by pryrt (Abbot) on Oct 15, 2021 at 14:17 UTC | |
by Bod (Parson) on Oct 15, 2021 at 17:03 UTC | |
by Bod (Parson) on Oct 15, 2021 at 18:14 UTC | |
by pryrt (Abbot) on Oct 15, 2021 at 18:30 UTC | |
by Bod (Parson) on Oct 15, 2021 at 21:13 UTC |