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 · 8 comments

Comments

Projects
None yet
2 participants
@njogun
Copy link

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

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link
Owner

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

#52 Add note when malloc fails
This note suggests adjusting max_mem
@samboy

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Owner

samboy commented Jan 19, 2019

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

@samboy

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link
Owner

samboy commented Jan 21, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment