luamail crash sometimes when we intensive resize luamail window #69

Closed
7histle opened this Issue Jul 20, 2013 · 5 comments

Projects

None yet

2 participants

@7histle
7histle commented Jul 20, 2013
mode:maildir limit:alterminate called after throwing an instance of 'std::out_of_range'4:14:29ildir limit:all  what():  vector::_M_range_check
Program received signal SIGABRT, Aborted.


#0  0x00007ffff6777425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff677ab8b in __GI_abort () at abort.c:91
#2  0x00007ffff70c969d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff70c7846 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff70c7873 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff70c796e in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7074987 in std::__throw_out_of_range(char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00000000004116a7 in std::vector<CMaildir, std::allocator<CMaildir> >::_M_range_check (this=0x7fffffffdc60, __n=18446744073709551615)
    at /usr/include/c++/4.6/bits/stl_vector.h:719
#8  0x000000000041081b in std::vector<CMaildir, std::allocator<CMaildir> >::at (this=0x7fffffffdc60, __n=18446744073709551615)
    at /usr/include/c++/4.6/bits/stl_vector.h:737
#9  0x000000000042b526 in CScreen::drawMaildir (this=0x7fffffffde30) at screen.cc:208
#10 0x000000000042b145 in CScreen::refresh_display (this=0x7fffffffde30) at screen.cc:75
#11 0x000000000042abbe in main (argc=3, argv=0x7fffffffe168) at main.cc:279
@7histle 7histle was assigned Jul 20, 2013
@skx
Contributor
skx commented Jul 20, 2013

Suspect the issue is a resize during a redraw. We call CScreen::height and use that value for the loop.

Not sure what the fix should be.

@skx
Contributor
skx commented Jul 23, 2013

FWIW I cannot reproduce this. I see messages "Unknown key: KEY_RESIZE", but no crash.

@skx
Contributor
skx commented Jul 24, 2013

FWIW. I'm using bluetile + gnome-terminal.

I guess it is the problem of the size changing though. We see from your backtrace:

#10 0x000000000042b145 in CScreen::refresh_display (this=0x7fffffffde30) at screen.cc:75
#9 0x000000000042b526 in CScreen::drawMaildir (this=0x7fffffffde30) at screen.cc:208
#6 0x00007ffff7074987 in std::throw_out_of_range(char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

So it's an out of range at the vector. I'd look at this code:

    if (mailIndex < count)
    {
        cur = display.at(mailIndex);
        unread = cur->unread_messages();
    }

That's the only vector-use in drawMaildir, and if the height changed part-way through the loop it might die there.

Test that the size is OK, then skip if not. Something like this should be a quick fix if I'm right:

 if ( mailindex < count )
 {
        if ( mailIndex < display.size() ){
        cur = display.at(mailIndex);
        unread = cur->unread_messages();
        } else {  cur = NULL; unread = 0; }
    }
 }
@skx skx added a commit that referenced this issue Jul 24, 2013
@skx skx Bound the access to the maildirs.
  This updates #69, and hopefully prevents the crash on resize.
bca3214
@skx
Contributor
skx commented Jul 24, 2013

I've made an update with what I think is the solution; literally the size-test on the vector as in my previous comment.

If this does fix the issue please close. If not could you give a new backtrace, so we can track it down more specifically - lots of code has changed recently.

@7histle
7histle commented Jul 24, 2013

It seems that the bug has been fixed.

@7histle 7histle closed this Jul 24, 2013
@7histle 7histle was unassigned by skx Oct 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment