Hi Using notifyd you get NOTIFY(EVENT): datagram too large when using notifyd It is bececase net.local.dgram.maxdgram is smaller than on linux default is 2048 so you get a bufsiz of 204-32=172 most events are bigger. so add_arg fails here: if (*buflen + len > max_size) return -1; (max_size is bufsiz) a Workaround is to set sysctl net.local.dgram.maxdgram higher e.g to 655552 But perhaps a patch that does not divide with 10 work-basic/cyrus-imapd-3.4.1/imap/notify.c:223: bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE); work-basic/cyrus-imapd-3.4.1/notifyd/notifyd.c:123: bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE); Is better?
Created attachment 225796 [details] proposed patch to fix notify issue
Thank you for the report. I think it is better to increase the size of socket buffer. Is the attached patch work for you?
(In reply to Hajimu UMEMOTO from comment #2) Thanks. Yes the patch works for me, I do not know how large the events can become though. Perhaps this should be discussed with upstream? The settings triggering this bug (without the patch) btw is event_notifier: external notify_external: /usr/local/bin/dump.pl cat /usr/local/bin/dump.pl #!/usr/local/bin/perl use strict; use warnings; open FH,">/tmp/t"; while (<STDIN>) { print FH $_ } It might be a problem on older cyrus-imapd versions as well.
(In reply to Jesper Schmitz Mouridsen from comment #3) > Yes the patch works for me, I do not know how large the events can become though. > Perhaps this should be discussed with upstream? Thank you for testing. I'm not sure how large the buffer is, too. In any way, it doesn't work on other than Linux at least FreeBSD. So, it should be reported to upstream. > The settings triggering this bug (without the patch) btw is > > event_notifier: external > notify_external: /usr/local/bin/dump.pl Btw, you can put the notification to syslog by the following setting: event_notifier: log > It might be a problem on older cyrus-imapd versions as well. Yes, the change was committed on 18 Jul 2017 by following issue: https://github.com/cyrusimap/cyrus-imapd/issues/1674
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=2d1887b68b126bf7cec16962f807ac266dc4c4df commit 2d1887b68b126bf7cec16962f807ac266dc4c4df Author: Hajimu UMEMOTO <ume@FreeBSD.org> AuthorDate: 2021-06-19 08:39:13 +0000 Commit: Hajimu UMEMOTO <ume@FreeBSD.org> CommitDate: 2021-06-19 08:48:06 +0000 mail/cyrus-imapd3[24]: NOTIFY(EVENT): datagram too large when using notifyd. PR: 256478 Reported by: jsm mail/cyrus-imapd32/Makefile | 2 +- .../cyrus-imapd32/files/patch-imap__notify.c (new) | 45 ++++++++++++++++++++ .../files/patch-notifyd__notifyd.c (new) | 44 ++++++++++++++++++++ mail/cyrus-imapd34/Makefile | 2 +- .../cyrus-imapd34/files/patch-imap__notify.c (new) | 48 ++++++++++++++++++++++ .../files/patch-notifyd__notifyd.c (new) | 44 ++++++++++++++++++++ 6 files changed, 183 insertions(+), 2 deletions(-)
I've raised the issue: https://github.com/cyrusimap/cyrus-imapd/issues/3531