[Bug 234494] dns/maradns: memory exhaustion with default config (with workaround)
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Dec 29 21:03:42 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234494
Bug ID: 234494
Summary: dns/maradns: memory exhaustion with default config
(with workaround)
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Individual Port(s)
Assignee: je3kmz at FreeBSD.org
Reporter: nino80 at gmail.com
Flags: maintainer-feedback?(je3kmz at FreeBSD.org)
Assignee: je3kmz at FreeBSD.org
12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC i386 w/ 512MB RAM
After upgrading the system to 12.0-RELEASE and updating MaraDNS to the latest
package (2.0.15), MaraDNS started consistently crashing with the following
error in the log:
Dec 28 12:58:31 srv /usr/local/sbin/maradns: Aieeeeee, can not allocate memory!
Traced the error to the following code section in js_alloc() in JsStrOS.c:
data = (void *)malloc(unit_count * unit_size);
...
if(data == NULL) {
/* Securty: In a situtation where we can not allocate memory,
the subsequent behavior of the program is undefined. Hence,
the best thing to do is exit then and there */
printf("Aieeeeee, can not allocate memory!");
exit(64);
return (void *)0;
}
Results in the following trace:
mmap(0x0,20480,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) ERR#12
'Cannot allocate memory'
write(1,"Aieeeeee, can not allocate memor"...,34) = 34 (0x22)
exit(0x40)
MaraDNS appears to limit memory usage itself to about 2.5MB by default:
setrlimit(RLIMIT_VMEM,{ cur=2646016,max=2646016 }) = 0 (0x0)
I have checked the arguments to malloc (unit_count, unit_size) and the overall
memory allocation and there doesn't appear to be a bug or a leak. While MaraDNS
is not memory-hungry, it seems that small heap size and some heap fragmentation
is enough to exhaust the available memory.
Workaround is to add max_mem parameter to mararc config. I have set it to 8MB
(in bytes) and that helped to avoid crash so far. Will keep monitoring and
update the PR if further crashes are experienced.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-ports-bugs
mailing list