I plan to issue a PR to MacPorts’s dovecot port with the patch below on macOS 
12.

Is anyone able to offer a better workaround, or explain the pitfalls of 
removing these non-working lines?

Patch:

> --- ./src/lib/restrict-process-size.c 2021-12-19 11:46:50.000000000 -0500
> +++ ./src/lib/restrict-process-size.c 2021-12-19 11:49:13.000000000 -0500
> @@ -9,18 +9,24 @@
>  {
>       struct rlimit rlim;
>  
> -     rlim.rlim_max = rlim.rlim_cur = bytes;
> -     if (setrlimit(RLIMIT_DATA, &rlim) < 0) {
> -             i_fatal("setrlimit(RLIMIT_DATA, %llu): %m",
> -                     (unsigned long long)bytes);
> -     }
>  
> -#ifdef HAVE_RLIMIT_AS
> -     if (setrlimit(RLIMIT_AS, &rlim) < 0) {
> -             i_fatal("setrlimit(RLIMIT_AS, %llu): %m",
> -                     (unsigned long long)bytes);
> -     }
> -#endif
> +/*
> + * Workaround for issue with dovercot version 2.3.17 on macOS 12
> + * https://www.mail-archive.com/dovecot@dovecot.org/msg84784.html
> + * 
> + *   rlim.rlim_max = rlim.rlim_cur = bytes;
> + *   if (setrlimit(RLIMIT_DATA, &rlim) < 0) {
> + *           i_fatal("setrlimit(RLIMIT_DATA, %llu): %m",
> + *                   (unsigned long long)bytes);
> + *   }
> + * 
> + * #ifdef HAVE_RLIMIT_AS
> + *   if (setrlimit(RLIMIT_AS, &rlim) < 0) {
> + *           i_fatal("setrlimit(RLIMIT_AS, %llu): %m",
> + *                   (unsigned long long)bytes);
> + *   }
> + * #endif
> +*/
>  }
>  
>  void restrict_process_count(rlim_t count ATTR_UNUSED)




> On Dec 19, 2021, at 12:00 PM, Steven Smith <steve.t.sm...@gmail.com> wrote:
> 
> I confirm that a working workaround on macOS 12 is to simply remove these 
> lines from ./src/lib/restrict-process-size.c:
> 
> https://github.com/dovecot/core/blob/a5209c83c3a82386c94d466eec5fea394973e88f/src/lib/restrict-process-size.c#L12-L23
>  
> <https://github.com/dovecot/core/blob/a5209c83c3a82386c94d466eec5fea394973e88f/src/lib/restrict-process-size.c#L12-L23>
> 
> 
>> On Dec 19, 2021, at 11:26 AM, Steven Smith <steve.t.sm...@gmail.com 
>> <mailto:steve.t.sm...@gmail.com>> wrote:
>> 
>> Re: https://www.mail-archive.com/dovecot@dovecot.org/msg84784.html 
>> <https://www.mail-archive.com/dovecot@dovecot.org/msg84784.html>
>> 
>> I just upgraded to macOS 12.1, ran into this issue, and discovered this 
>> thread from the error message.
>> 
>> Is there a viable workaround or patch yet?
>> 
>> I tried the workaround in this thread, and still see these issues.
>> 
>> Set default_vsz_limit = 0 in ./conf.d/10-master.conf.
>> 
>> Observe that:
>> dovecot now launches without the setrlimit(RLIMIT_DATA, 268435456) error at 
>> the command line
>> However, the mail-err.log is still filled with these errors (below), perhaps 
>> for the child processes.
>> 
>> Steve
>> 
>> 
>>> Dec 19 11:22:06 imap-login: Error: Dec 19 11:22:06 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:06 imap-login: Error: Dec 19 11:22:06 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:06 imap-login: Error: Dec 19 11:22:06 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:06 imap-login: Error: Dec 19 11:22:06 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:06 imap-login: Error: Dec 19 11:22:06 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:06 imap-login: Fatal: master: service(imap-login): child 4629 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:06 master: Error: service(imap-login): command startup failed, 
>>> throttling for 2.000 secs
>>> Dec 19 11:22:06 imap-login: Fatal: master: service(imap-login): child 4630 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:06 imap-login: Fatal: master: service(imap-login): child 4628 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:06 imap-login: Fatal: master: service(imap-login): child 4627 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:06 imap-login: Fatal: master: service(imap-login): child 4619 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:06 imap-login: Error: Dec 19 11:22:06 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:06 imap-login: Fatal: master: service(imap-login): child 4631 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:09 imap-login: Error: Dec 19 11:22:09 service(imap-login): 
>>> Fatal: setrlimit(RLIMIT_DATA, 2147483648): Invalid argument
>>> Dec 19 11:22:09 imap-login: Fatal: master: service(imap-login): child 4638 
>>> returned error 89 (Fatal failure)
>>> Dec 19 11:22:09 master: Error: service(imap-login): command startup failed, 
>>> throttling for 4.000 secs
>> 
>> 
>> 
>> 
>>> On Mon, 1 Nov 2021 14:55:25 +0200, Aki Tuomi said:
>>> 
>>> I think this is happening because MacOS no longer supports RLIMIT_DATA. 
>>> We'll 
>>> try to look into this. default_vsz_limit = 0 seems good enough workaround.
>>> Aki
>> 
>> 
> 

Reply via email to