#378 new
Bill Cole

mmap failure misinterpreted (?) as missing file (?)

Reported by Bill Cole | April 15th, 2013 @ 03:38 PM

I've had multiple cases of MM (multiple versions through r3323) responding to a search by bringing up a dialog claiming a corrupted database due to database files (usually "strings" files) being missing, offering no option but to quit and implying the need for a DB rebuild, which in my (arguably pathological) case is an hours-long process from local cache and day-long task if re-fetching. Direct examination of the filesystem shows that the cited file is not actually missing but is quite big. Syslog shows an error like this:

Apr 15 06:13:39 deepfield [0x0-0x4dc4dc].com.freron.MailMate[40671]: mmap: Cannot allocate memory

I think what is actually happening is that the system has become so memory starved that it can't mmap a big file, and MM is interpreting that as the file being missing without looking more closely at the cause of the mmap failure. It is also possible that there's some sort of race condition between MM threads where the file actually doesn't exist momentarily, but is present by the time I have looked for it. With either root cause, there should be ways to avoid a forced MM restart in some cases or at least to provide a more illuminating error message for the user that does not encourage a DB rebuild that is not actually needed.

It may be related that I've recently also had a series of hard crashes clearly due to memory starvation:

Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: MailMate(55877,0xac5822c0) malloc: *** mmap(size=2097152) failed (error code=12) Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: *** error: can't allocate region Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: *** set a breakpoint in malloc_error_break to debug Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: MailMate(55877,0xac5822c0) malloc: *** mmap(size=2097152) failed (error code=12) Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: *** error: can't allocate region Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: *** set a breakpoint in malloc_error_break to debug Apr 15 10:24:15 deepfield [0x0-0x4dc4dc].com.freron.MailMate[0]: terminate called throwing an exception

Of course, sys/errno.h tells me that ENOMEM=12 and the documentation of mmap() explains some ways that can happen. With those hard crashes, the 0xac5822c0 address cited (EDI register? a fixed address???) has been the same across multiple crashes of both r3271 and r3323.

Comments and changes to this ticket

  • Bill Cole

    Bill Cole April 15th, 2013 @ 03:50 PM

    • no changes were found...
  • Bill Cole

    Bill Cole April 15th, 2013 @ 03:51 PM

    • no changes were found...
  • Bill Cole

    Bill Cole April 15th, 2013 @ 03:52 PM

    • no changes were found...
  • benny

    benny April 16th, 2013 @ 01:50 PM

    I don't think it is a race condition (for now). Large files (memory starvation) may be a more likely trigger since you have a very large database in MailMate. How often do you have these crashes? I could perhaps make a version which logs all the mmap'ings.

    Have you sent all crash reports? I cannot seem to find >= r3323 crashes which are related to this ticket. You are welcome to do so in the future since it makes it more likely that I'll pay attention to it :-) The crash reports are collected in a database and I can see statistics about which ones happen most often.

    Interesting fact: 10% of the crashes reported for >= r3255 are from you. This might also be an indication that MailMate is more unstable with more than 400K messages.

  • Bill Cole

    Bill Cole June 10th, 2021 @ 01:53 PM

    • Tag changed from database error, memory, crash to database error, crash, memory

    I have not seen this happen in over 5 years. I believe that it has been fixed by memory management improvements.

  • Bill Cole

    Bill Cole June 10th, 2021 @ 01:53 PM

    • Title changed from “mmap failure misinterpreted (?) as missing file (?) ” to “SOLVED: mmap failure misinterpreted (?) as missing file (?) ”
    • Tag changed from database error, memory, crash to database error, crash, memory
  • benny

    benny June 17th, 2021 @ 02:37 PM

    • State changed from “new” to “closed”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins

People watching this ticket

Pages