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

add debug output and missing exception handlers to fix #459 #460

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

madmas
Copy link

@madmas madmas commented May 6, 2020

add debug outout and exception handling fix to get rid of over-and-over sent notifications.

I think esp. the changes to line 410 helped to fix the issue.

@kesselb
Copy link
Contributor

kesselb commented Jun 17, 2020

How does logException fixes something? Mind to share $e->getMessage() to see why sending the email failed?

@madmas
Copy link
Author

madmas commented Jun 24, 2020

Hi @kesselb , sorry, I switched the lines, I think the actual fix is below, in line 415. 410 of course only helps in regard of debugging ;-)

@madmas madmas force-pushed the endlessNotificationsFix branch from e85a42f to 19e481f Compare June 24, 2020 10:12
@kesselb
Copy link
Contributor

kesselb commented Jun 24, 2020

Mind to share the exception? Also you overwrite the actual exception message. That makes it harder to debug.

Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

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

I'm not convinced. Right now the error handling code fails and the original exception message is replaced with a generic error message.

lib/MailQueueHandler.php Outdated Show resolved Hide resolved
lib/MailQueueHandler.php Outdated Show resolved Hide resolved
@@ -405,6 +407,12 @@ protected function sendEmailToUser($userName, $email, $lang, $timezone, $maxTime
try {
$this->mailer->send($message);
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Failed sending email to user "{user}"',
'user' => $user,
Copy link
Contributor

@kesselb kesselb Jun 24, 2020

Choose a reason for hiding this comment

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

Log the exception with $this->logger->logException($e); and log a additional warning $this->logger->warning('Failed to send notification email for user {user}', ['user' => $userName]);. You cannot use $user because it's a IUser object. Ah that might work as the normalizer will format it. I would still prefer the $userName ;)

change the glue for implode from | to ,

Co-authored-by: kesselb <[email protected]>
@madmas
Copy link
Author

madmas commented Jun 26, 2020

I'm not convinced. Right now the error handling code fails and the original exception message is replaced with a generic error message.

My experience was vice versa - with the output I added with shown here, I got much more details.
I cannot share the exception as after implementing this, I don't see them happen on my system anymore....

@kesselb
Copy link
Contributor

kesselb commented Jun 26, 2020

We still don't know why sending the notification failed in the first place. This is fixing symptoms not problems 😟

@blizzz blizzz modified the milestones: Nextcloud 27, Nextcloud 28 May 23, 2023
@blizzz blizzz mentioned this pull request Nov 20, 2023
5 tasks
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@blizzz blizzz modified the milestones: Nextcloud 29, Nextcloud 30 Apr 8, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 22, 2024
44 tasks
@blizzz blizzz modified the milestones: Nextcloud 30, Nextcloud 31 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants