Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXED: Memory exhaustion (possibly FreeBSD-specific?) #52

Closed
njogun opened this issue Dec 29, 2018 · 10 comments
Closed

FIXED: Memory exhaustion (possibly FreeBSD-specific?) #52

njogun opened this issue Dec 29, 2018 · 10 comments

Comments

@njogun
Copy link

@njogun njogun commented Dec 29, 2018

Hi Sam,

Long term happy MaraDNS user here - thanks!

After latest updates to the OS and MaraDNS I started experiencing consistent crashes of MaraDNS with the default config (specifically with no max_mem parameter in mararc) giving the following error:
Dec 28 12:58:31 srv /usr/local/sbin/maradns: Aieeeeee, can not allocate memory!

I set max_mem to 8MB in my config as a workaround which seems to resolve the issue for me. Hence this is not a support request (and is likely specific to FreeBSD which is not a supported platform anyway - happy for the issue to be closed if so). However, I wanted to report it here for your perusal in case there is more to it.

I have provided technical details in FreeBSD bug report (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234494).

@samboy
Copy link
Owner

@samboy samboy commented Jan 5, 2019

Changing the default for 2019 should be a one-line fix, and I would be happy to do that. The old value for max_mem is from 12 years ago, when computers came with about 512 megs of memory and maxed out at two gigabytes. I’ll probably make it 16mb, along with a note for people still using things like $15/year 128mb OpenVZ virtual machines.

@samboy
Copy link
Owner

@samboy samboy commented Jan 7, 2019

Here is the actual code in question in MaraDNS.c:

    maxprocs = read_numeric_kvar("max_mem",
               1048576 + thread_overhead +
               ((cache_size + dns_records_served) * 1536));

The final argument is the default value; I can easily double those in this day and age of 64-bit servers.

samboy added a commit that referenced this issue Jan 7, 2019
@samboy
Copy link
Owner

@samboy samboy commented Jan 7, 2019

If max_mem is set in FreeBSD’s mararc file, it’s up to the FreeBSD team to fix it (none of the mararc files I supply as examples set this); however, I can and have doubled the default value if max_mem is not set on my side of things.

samboy added a commit that referenced this issue Jan 8, 2019
samboy added a commit that referenced this issue Jan 8, 2019
This note suggests adjusting max_mem
@samboy
Copy link
Owner

@samboy samboy commented Jan 8, 2019

I have fixed the issue and have committed the code. I will close this ticket when I make a new MaraDNS tarball with the updated code.

@njogun
Copy link
Author

@njogun njogun commented Jan 12, 2019

Hi Sam,

Thanks for looking into this issue and appreciate the fix.

P.S.
I saw you made some documentation updates so I thought I would mention that a few places describe max_mem setting to be in kilobytes e.g. parse/ParseMaraRc.c (lines 141-142)

        "max_mem", /* The maximum amount of memory we allow MaraDNS to
                    * allocate, in kilobytes */

More importantly man page is correct.

samboy added a commit that referenced this issue Jan 19, 2019
samboy added a commit that referenced this issue Jan 19, 2019
@samboy
Copy link
Owner

@samboy samboy commented Jan 19, 2019

Done. Let me know if there is anywhere else where this memory is incorrectly labeled “kilobytes”.

@samboy
Copy link
Owner

@samboy samboy commented Jan 20, 2019

MaraDNS 2.0.17 tarball made:

While I still need to make the Windows binary, update the webpage, and make a formal announcement before MaraDNS 2.0.17 is released, I am closing this ticket.

@samboy samboy closed this Jan 20, 2019
@samboy samboy changed the title Memory exhaustion (possibly FreeBSD-specific?) FIXED: Memory exhaustion (possibly FreeBSD-specific?) Jan 20, 2019
@samboy
Copy link
Owner

@samboy samboy commented Jan 21, 2019

MaraDNS 2.0.17 finished and release announced: https://samiam.org/blog/2019-01-20.html

Repository owner locked as resolved and limited conversation to collaborators Feb 24, 2019
@samboy
Copy link
Owner

@samboy samboy commented Feb 24, 2019

Locking conversation to avoid spam.

@samboy
Copy link
Owner

@samboy samboy commented May 7, 2021

Ubuntu 20.04’s old version of MaraDNS still has this bug. The workaround is to, if using the Ubuntu-supplied MaraDNS package, to add something like this in the /etc/maradns/mararc file:

max_mem = 4000000

Note that max_mem is in bytes, not kilobytes (this documentation bug was also fixed over two years ago, but Debian/Ubuntu packages are very slow to update things).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants