]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: When logging fork() EAGAIN failure, include current ulimit -u value
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 29 Mar 2017 22:42:53 +0000 (01:42 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Mar 2017 17:56:16 +0000 (20:56 +0300)
src/master/service-process.c

index 67503cfb2119c163426970e349d440de091d1200..02c714d68ae89f0def95929c177b28cb0b432e91 100644 (file)
@@ -314,7 +314,17 @@ struct service_process *service_process_create(struct service *service)
        }
 
        if (pid < 0) {
-               service_error(service, "fork() failed: %m");
+               int fork_errno = errno;
+               rlim_t limit;
+               const char *limit_str = "";
+
+               if (fork_errno == EAGAIN &&
+                   restrict_get_process_limit(&limit) == 0) {
+                       limit_str = t_strdup_printf(" (ulimit -u %llu reached?)",
+                                                   (unsigned long long)limit);
+               }
+               errno = fork_errno;
+               service_error(service, "fork() failed: %m%s", limit_str);
                return NULL;
        }
        if (pid == 0) {