Skip to content

Fix regex for hiding some messages from the error log - #608

Open
wfyson wants to merge 1 commit into
eprints:masterfrom
wfyson:storage-error-log-fix
Open

Fix regex for hiding some messages from the error log#608
wfyson wants to merge 1 commit into
eprints:masterfrom
wfyson:storage-error-log-fix

Conversation

@wfyson

@wfyson wfyson commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Minor fix to tidy up some error log content. From @mephillips-durham

The Apache error log quite frequently contains reports like this:

------------------------------------------------------------------
----------- EPrints System Error 2026-03-26T14:13:03Z ------------
------------------------------------------------------------------
Error in file retrieval: :Apache2 IO write: (103) Software caused connection abort at /opt/eprints3/perl_lib/EPrints/Apache/Storage.pm line 282
------------------------------------------------------------------
at /opt/eprints3/perl_lib/EPrints/Apache/Storage.pm line 291.
  EPrints::Apache::Storage::handler(Apache2::RequestRec=SCALAR(0x7f6d4d05ed80)) called at -e line 0
  eval {...} called at -e line 0

David McBride has had a look at the code and points out that there is a regular expression which is supposed to avoid 'Software cause connection abort' from being logged like this. But as it is anchored to the start of the string it does not match our error, which starts :Apache2 IO write: (103).

Removing the ^ would improve things, and you might want to add :Apache2... to match the others. Could you consider feeding this back upstream as well as committing it to git for our installation?

else # OK normal response
        {
                EPrints::Apache::AnApache::header_out(
                        $r,
                        "Content-Length" => $content_length
                );
                $rv = eval { $fileobj->get_file( sub { print $_[0] } ) };
        }

        if( $@ )
        {
                # eval threw an error
                # If the software (web client) stopped listening
                # before we stopped sending then that's not a fail.
                # even if $rv was not set
                if(
                        $@ !~ m/^Software caused connection abort/ &&
                        $@ !~ m/:Apache2 IO write: \(104\) Connection reset by peer/ &&
                        $@ !~ m/:Apache2 IO write: \(32\) Broken pipe/ &&
                        $@ !~ m/:Apache2 IO write: \(70007\) The timeout specified has expired/
                  )
                {
                        EPrints::abort( "Error in file retrieval: $@" );
                }
                else
                {
                        # Shows in httpd logs as 499, even though the client
                        # received a '200 Ok' response. From nginx
                        return 499;
                }
        }

@drn05r drn05r changed the title Fix regex for hiding some messages from the erorr log Fix regex for hiding some messages from the error log Sep 3, 2026

@drn05r drn05r left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also noted this happens because of

$@ !~ m/^Software caused connection abort/ &&
it would be useful to fix this at the same time as it looks to be very similar code that is causing an issue.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants