The get_max_filters method gets called on module load to fill the
default value used, at that stage we cannot know if the admin set
max_filters manually or not, so the warning might be bogus and thus
annoying.
Move it over to the smtp-filter executable's startup code, as there we
can check the config if it's max_filters is set or not.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
my $base;
my $memory = physical_memory();
if ($memory < 3840) {
- warn "low amount of system memory installed, recommended is 4+ GB\n"
- ."to prevent OOM kills, it is better to set max_filters manually\n";
+ warn "low amount of system memory installed, recommended is 4+ GB\n";
$base = $memory > 1536 ? 1024 : 512;
} else {
$base = 2816;
exit (0);
}
+ my $memory = PMG::Config::Mail::physical_memory();
+ if ($memory < 3840) {
+ warn "total memory below 4 GiB, consider setting 'max_filters' manually to avoid OOM-kills\n"
+ if !defined($pmg_cfg->get('mail', 'max_filters', 1));
+ }
+
$max_servers = $pmg_cfg->get('mail', 'max_filters') + 2;
$min_servers = 2;
$min_spare_servers = 1;