Skip to content

Improve exception serializing - #35970

Merged
juliusknorr merged 3 commits into
masterfrom
perf/noid/exception-serializer
Jan 16, 2023
Merged

Improve exception serializing#35970
juliusknorr merged 3 commits into
masterfrom
perf/noid/exception-serializer

Conversation

@juliusknorr

@juliusknorrjuliusknorr commented Jan 3, 2023

Copy link
Copy Markdown
Member

Summary

Small improvement to not start serializing an exception during logging if the log level would skip it anyways. Noticed when seeing errors due to Nesting level too deep - recursive dependency? at /var/www/html/lib/private/Log/ExceptionSerializer.php#215 while there was no actual error logged when commenting out the argument cleanup

The second commit avoids such cases by handling the arguments first (which limits to a recursion depth of 5) before iterating over them for filtering for sensitive parameters.

Checklist

@juliusknorr
juliusknorr requested review from a team, ArtificialOwl, PVince81, blizzz and icewind1991 and removed request for a teamJanuary 3, 2023 18:05
@juliusknorrjuliusknorr added the 3. to review Waiting for reviews label Jan 3, 2023
@juliusknorrjuliusknorr changed the title perf(logging): Return early when log level does not match before serializing an exceptionImprove exception serializingJan 3, 2023
@szaimenszaimen added this to the Nextcloud 26 milestone Jan 3, 2023
@solracsf

solracsf commented Jan 4, 2023

Copy link
Copy Markdown
Member

Does this fix #32432 and #35413?

@juliusknorr

Copy link
Copy Markdown
MemberAuthor

Does this fix #32432 and #35413?

Likely doesn't fix it but would lead to getting a proper error message instead of the generic error caused within the logging parts.

@juliusknorr

Copy link
Copy Markdown
MemberAuthor

Or wait, it may still help if the error was not logged due to a lower log level.

@PhrozenByte

Copy link
Copy Markdown
Member

Should also fix (resp. circumvent) #23429

Comment threadlib/private/Log.php
@juliusknorr
juliusknorrforce-pushed the perf/noid/exception-serializer branch from e0d92cd to 6c996eeCompareJanuary 11, 2023 18:06

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 :shipit: otherwise

Comment threadlib/private/Log.php Outdated
$level = $context['level'] ?? ILogger::ERROR;

$minLevel = $this->getLogLevel($context);
if ($level < $minLevel && !$this->crashReporters->hasReporters()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

$this->crashReporters needs a null check

@juliusknorr
juliusknorrforce-pushed the perf/noid/exception-serializer branch from 6c996ee to ecf0793CompareJanuary 12, 2023 15:06

@blizzzblizzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wondering about #35970 (comment)

…alizing an exception
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This will avoid running into a Nesting level too deep error as the
encodeArg calls will limit potential recursive calls on the arguments to
a nesting level of 5
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliusknorr
juliusknorrforce-pushed the perf/noid/exception-serializer branch from ecf0793 to cf1bd0eCompareJanuary 16, 2023 08:47
@juliusknorrjuliusknorr removed the 3. to review Waiting for reviews label Jan 16, 2023
@juliusknorrjuliusknorr added bug 4. to release Ready to be released and/or waiting for tests to finish performance 🚀 labels Jan 16, 2023
@juliusknorr
juliusknorr merged commit 8557c61 into masterJan 16, 2023
@juliusknorr
juliusknorr deleted the perf/noid/exception-serializer branch January 16, 2023 13:00
@juliusknorr

Copy link
Copy Markdown
MemberAuthor

/backport 7daa20d to stable25

@juliusknorr

Copy link
Copy Markdown
MemberAuthor

/backport 7daa20d to stable24

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

Labels

4. to releaseReady to be released and/or waiting for tests to finishbugperformance 🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@juliusknorr@solracsf@PhrozenByte@ChristophWurst@blizzz@szaimen