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

Mail notification is broken #1254

Closed
rabesocke opened this issue Sep 17, 2019 · 15 comments · Fixed by #2117
Closed

Mail notification is broken #1254

rabesocke opened this issue Sep 17, 2019 · 15 comments · Fixed by #2117

Comments

@rabesocke
Copy link

rabesocke commented Sep 17, 2019

Steps to reproduce

  1. Change description or user assignment or anything that creates a mail notification
  2. Wait for sending the mail notification
  3. See error in the log

Expected behaviour

There should be no error and the mail notification should be sent.

Actual behaviour

No mail notification is sent.

Server configuration detail

Operating system: Linux 4.19.0-0.bpo.5-amd64 #1 SMP Debian 4.19.37-5+deb10u2~bpo9+1 (2019-08-16) x86_64

Webserver: nginx/1.10.3 (fpm-fcgi)

Database: mysql 10.1.38

PHP version:

7.3.9-1+020190902.44+debian91.gbpf8534c
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imagick, intl, json, exif, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, smbclient, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, libsmbclient, Zend OPcache

Nextcloud version: 16.0.4 - 16.0.4.1

Updated from an older Nextcloud/ownCloud or fresh install: Update from Owncloud 9 to Nextcloud 10 and then all available updates

Where did you install Nextcloud from: Crossupdate from website

Signing status

Array
(
)

List of activated apps
Enabled:
 - accessibility: 1.2.0
 - activity: 2.9.1
 - admin_audit: 1.6.0
 - apporder: 0.7.1
 - calendar: 1.7.1
 - cloud_federation_api: 0.2.0
 - comments: 1.6.0
 - contacts: 3.1.3
 - dav: 1.9.2
 - deck: 0.6.6
 - drawio: 0.9.3
 - federatedfilesharing: 1.6.0
 - federation: 1.6.0
 - files: 1.11.0
 - files_external: 1.7.0
 - files_pdfviewer: 1.5.0
 - files_rightclick: 0.15.1
 - files_sharing: 1.8.0
 - files_texteditor: 2.8.0
 - files_trashbin: 1.6.0
 - files_versions: 1.9.0
 - files_videoplayer: 1.5.0
 - gallery: 18.3.0
 - groupfolders: 4.1.0
 - issuetemplate: 0.5.0
 - keeweb: 0.5.1
 - logreader: 2.1.0
 - lookup_server_connector: 1.4.0
 - notifications: 2.4.1
 - oauth2: 1.4.2
 - onlyoffice: 3.0.0
 - password_policy: 1.6.0
 - polls: 0.10.2
 - privacy: 1.0.0
 - provisioning_api: 1.6.0
 - rainloop: 6.0.3
 - richdocuments: 3.4.1
 - serverinfo: 1.6.0
 - sharebymail: 1.6.0
 - spreed: 6.0.4
 - support: 1.0.0
 - systemtags: 1.6.0
 - tasks: 0.11.2
 - theming: 1.7.0
 - twofactor_backupcodes: 1.5.0
 - updatenotification: 1.6.0
 - viewer: 1.1.0
 - workflowengine: 1.6.0
Disabled:
 - encryption
 - firstrunwizard
 - mail
 - nextcloud_announcements
 - recommendations
 - survey_client
 - user_ldap

Configuration (config/config.php)
{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "***REMOVED SENSITIVE VALUE***"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "16.0.4.1",
    "installed": true,
    "memcache.local": "\\OC\\Memcache\\APCu",
    "user_webdavauth_url": "",
    "theme": "",
    "log_type": "file",
    "loglevel": 2,
    "logtimezone": "Europe\/Berlin",
    "maintenance": false,
    "trashbin_retention_obligation": "auto",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpmode": "smtp",
    "mail_smtpsecure": "ssl",
    "mail_smtpauthtype": "LOGIN",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "465",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "mysql.utf8mb4": true,
    "mail_sendmailmode": "smtp"
}

Are you using external storage, if yes which one: smb

Are you using encryption:

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

Operating system: MacOS X 10.14.6

Logs

Web server error log
No webserver error.
Nextcloud log
[cron] Error: TypeError: Argument 3 passed to OCA\Deck\Activity\DeckProvider::setSubjects() must be of the type array, null given, called in /xxx/apps/deck/lib/Activity/DeckProvider.php on line 151 at <<closure>>

0. /xxx/apps/deck/lib/Activity/DeckProvider.php line 151
   OCA\Deck\Activity\DeckProvider->setSubjects(OC\Activity\Event {}, "{user} has adde ... }", null)
1. /xxx/apps/activity/lib/MailQueueHandler.php line 447
   OCA\Deck\Activity\DeckProvider->parse("en", OC\Activity\Event {})
2. /xxx/apps/activity/lib/MailQueueHandler.php line 352
   OCA\Activity\MailQueueHandler->parseEvent("en", OC\Activity\Event {})
3. /xxx/apps/activity/lib/MailQueueHandler.php line 163
   OCA\Activity\MailQueueHandler->sendEmailToUser("xxx", "xxx@xxx.xx", "en", "Europe/Berlin", 1568662205)
4. /xxx/apps/activity/lib/BackgroundJob/EmailNotification.php line 65
   OCA\Activity\MailQueueHandler->sendEmails(500, 1568662205)
5. /xxx/lib/private/BackgroundJob/Job.php line 61
   OCA\Activity\BackgroundJob\EmailNotification->run(null)
6. /xxx/lib/private/BackgroundJob/TimedJob.php line 55
   OC\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})
7. /xxx/cron.php line 123
   OC\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

at 2019-09-16T21:30:07+02:00
Browser log

No browser error.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@rabesocke
Copy link
Author

Some more information: I have had this situation several times in the last two weeks.

At the moment the mail notification is working again after I deleted all entries of activity_mq. But that fix does not work everytime.

@mamatt
Copy link

mamatt commented Oct 10, 2019

I can confirme the bug (NC 15 & Deck 0.6.6)

If I force activity:send-mails I get :

An unhandled exception has been thrown:
TypeError: Argument 3 passed to OCA\Deck\Activity\DeckProvider::setSubjects() must be of the type array, null given, called in /var/www/nextcloud/apps/deck/lib/Activity/DeckProvider.php on line 151 and defined in /var/www/nextcloud/apps/deck/lib/Activity/DeckProvider.php:162
Stack trace:
#0 /var/www/nextcloud/apps/deck/lib/Activity/DeckProvider.php(151): OCA\Deck\Activity\DeckProvider->setSubjects(Object(OC\Activity\Event), '{user} a ajout\xC3...', NULL)
#1 /var/www/nextcloud/apps/activity/lib/MailQueueHandler.php(469): OCA\Deck\Activity\DeckProvider->parse('fr', Object(OC\Activity\Event))
#2 /var/www/nextcloud/apps/activity/lib/MailQueueHandler.php(374): OCA\Activity\MailQueueHandler->parseEvent('fr', Object(OC\Activity\Event))
#3 /var/www/nextcloud/apps/activity/lib/MailQueueHandler.php(183): OCA\Activity\MailQueueHandler->sendEmailToUser('abelard-a', 'arnaud.abelard@...', 'fr', 'Europe/Berlin', 1570713059)
#4 /var/www/nextcloud/apps/activity/lib/Command/SendEmails.php(111): OCA\Activity\MailQueueHandler->sendEmails(500, 1570713059, true, NULL)
#5 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Activity\Command\SendEmails->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/nextcloud/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/nextcloud/3rdparty/symfony/console/Application.php(946): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/nextcloud/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Activity\Command\SendEmails), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/nextcloud/console.php(96): OC\Console\Application->run()
#12 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

Deleting entries for activity_mq solve the issue !

Related to #921 ?

@rabesocke
Copy link
Author

rabesocke commented Oct 29, 2019

The last weeks the notification for deck issues didn't work at all. Even if I deleted all entries in activity_mq, the following errors appears in this order.

[PHP] Error: Undefined offset: 2 at /xxx/apps/deck/lib/Notification/Notifier.php#117
GET /ocs/v2.php/apps/notifications/api/v2/notifications

[PHP] Error: Undefined offset: 2 at /xxx/apps/deck/lib/Notification/Notifier.php#107
GET /ocs/v2.php/apps/notifications/api/v2/notifications

[PHP] Error: Undefined offset: 2 at /xxx/apps/deck/lib/Notification/Notifier.php#103
GET /ocs/v2.php/apps/notifications/api/v2/notifications

@mamatt
Copy link

mamatt commented Dec 12, 2019

Found the bug !
it happen when description is quite large. The DB field is limited to 4000 chars...

therefore we just need to truncate description below 4000, minus { " " and }

I'll try to make a PR, but this is simple to correct !

@mamatt
Copy link

mamatt commented Mar 4, 2020

I have digged a little more into the code.

It seems that the issue is more into the activity app.

When the event is created (CARD_UPDATE_DESCRIPTION), the subjectparams field from the oc_activity table is filled. There is no issue there as this field is a longtext type. So even if description is very long, it fit into the field.

However, when mails need to be sent, the oc_activity_mq table is feeded and here, the amq_subjectparams field is a VARCHAR(4000) !
Therefore, the copy between the two table fail !

From what I understand this copy is done by the app activity or by the nextcloud core.
@juliushaertl , can you confirm that ?

A simple solution is tho change field type from VARCHAR(4000) to LONGTEXT in the oc_activity_mq table.

@mamatt
Copy link

mamatt commented Mar 4, 2020

This is definitely a activity issue !
See :
https://github.com/nextcloud/activity/blob/2c6ec88c465ff79342b6c5ffbce03625f10f08e4/lib/Data.php#L124

There is no check when doing the insert into activity_mq

@juliusknorr
Copy link
Member

So we get an exception thrown if activity fails to create and entry in activity_mq, but we currently don't do anything with it. I'll see if we can trigger an activity without the description content in such cases then.

@mamatt
Copy link

mamatt commented Mar 23, 2020

not exactly ,activity is created created in activity_mq, but description is truncated.
So it result in a broken JSON, which can't be exploited by the mailing queue.

@RuiPereira
Copy link

Hello @mamatt . Is there a (system-wide) way to prevent the activity app from gathering notifications from Deck? This bug is preventing our server from sending any emails. I can clear periodically the Deck entries from the activity_mq table by hand, but that's a bit of a hack...

@mamatt
Copy link

mamatt commented Apr 17, 2020

As far as I know there is no such thing.
By the way, we have exactly the same issue and it's very annoying.

@juliusknorr juliusknorr modified the milestones: 1.0.1, 1.0.2 May 15, 2020
@juliusknorr juliusknorr modified the milestones: 1.0.2, 1.0.3 Jun 3, 2020
@juliusknorr juliusknorr modified the milestones: 1.0.3, 1.0.4 Jun 23, 2020
@juliusknorr
Copy link
Member

Are you also seeing an issue with this in the activity stream or is it just related to the mails?

@mamatt
Copy link

mamatt commented Jun 25, 2020

This is only for mail as in the DB the subjectparams field from activity_mq is limited to 4000 chars where the subjectparams from
activity message is text field.

The real issue is when copying from activity to activity_mq because an invalid json is pushed to the DB :
-> https://github.com/nextcloud/activity/blob/2c6ec88c465ff79342b6c5ffbce03625f10f08e4/lib/Data.php#L124

However the error is raised when only when activity queue try to re-read the json.

This a really a serious issue as it break all nextcloud activity mail, not only deck ones.

@rubo77
Copy link

rubo77 commented Jul 8, 2020

Is there an issue in the activity app already for this?

@rubo77
Copy link

rubo77 commented Dec 11, 2020

Why is this closed? Is there a follow up issue?

@juliusknorr
Copy link
Member

Well as linked this is mainly fixed by #2117

The size of the activity_mq table was fixed with nextcloud/activity#509

Is there any issue with this still please open a new issue

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

Successfully merging a pull request may close this issue.

5 participants