Kodi Community Forum

Full Version: Fedora 28: crash with Assertion '__builtin_expect(__n < this->size(), true)' failed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
OS: Fedora 28
Kodi: 17.6

On a fresh OS installation, Kodi is terminated (SIGABRT) right after displaying the splash screen with the following error message:

Code:
/usr/include/c++/8/bits/stl_vector.h:932: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator(std::vector<_Tp, _Alloc>::size_type) [with _Tp = SVertex; _Alloc = std::allocator<SVertex>; std::vector<_Tp, _Alloc>::reference = SVertex&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
/usr/bin/kodi: line 175:  7640 Aborted                 (core dumped) "$LIBDIR/${bin_name}/${bin_name}.bin" $SAVED_ARGS

-> Kodi crash log

The mentioned call to abort() happens in Thread 1, inside CGUIFontTTFGL::LastEnd():

gdb:
Thread 1 (Thread 0x7f3d3298d500 (LWP 6885)):
#0  0x00007f3d287f9f4b in raise () from /lib64/libc.so.6
#1  0x00007f3d287e4591 in abort () from /lib64/libc.so.6
#2  0x0000561020d9a485 in CGUIFontTTFGL::LastEnd() ()
#3  0x0000561020deead1 in CGUITextLayout::Render(float, float, float, unsigned int, unsigned int, unsigned int, float, bool) ()
#4  0x0000561020da03f7 in CGUIControl::DoRender() ()
#5  0x0000561020db0355 in CGUIControlGroupList::Render() ()
#6  0x0000561020da03f7 in CGUIControl::DoRender() ()
#7  0x0000561020db0355 in CGUIControlGroupList::Render() ()
#8  0x0000561020da03f7 in CGUIControl::DoRender() ()
#9  0x0000561020dad41e in CGUIControlGroup::Render() ()
#10 0x0000561020da03f7 in CGUIControl::DoRender() ()
#11 0x0000561020dad41e in CGUIControlGroup::Render() ()
#12 0x0000561020da03f7 in CGUIControl::DoRender() ()
#13 0x0000561020dad41e in CGUIControlGroup::Render() ()
#14 0x0000561020da03f7 in CGUIControl::DoRender() ()
#15 0x0000561020dad41e in CGUIControlGroup::Render() ()
#16 0x0000561020da03f7 in CGUIControl::DoRender() ()
#17 0x0000561020dad41e in CGUIControlGroup::Render() ()
#18 0x0000561020da03f7 in CGUIControl::DoRender() ()
#19 0x0000561020d7d018 in CGUIWindow::DoRender() ()
#20 0x0000561020d82e48 in CGUIWindowManager::RenderPass() const ()
#21 0x0000561020d8302f in CGUIWindowManager::Render() ()
#22 0x0000561021349eed in CApplication::Render() ()
#23 0x00005610213f2d45 in CXBApplicationEx::Run(CFileItemList&) ()
#24 0x00005610211451a0 in XBMC_Run ()
#25 0x0000561020c39fa9 in main ()
Possible fix: https://trac.kodi.tv/attachment/ticket/1...f-bo.patch

For v18 this is not needed. It was fixed there half a year ago.
There is a whole new exception in v18 that needs to be addressed. Antoine provided a v18 backtrace in the trac issue.
(2018-04-23, 17:52)mooninite Wrote: [ -> ]There is a whole new exception in v18 that needs to be addressed. Antoine provided a v18 backtrace in the trac issue.
 As you see yourself the issue is WIP and the reason is the ServiceManager transition.
Code:
/usr/include/c++/8/bits/stl_vector.h:950: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator(std::vector<_Tp, _Alloc>:Confusedize_type) const [with _Tp = SVertex; _Alloc = std::allocator<SVertex>; std::vector<_Tp, _Alloc>::const_reference = const SVertex&; std::vector<_Tp, _Alloc>:Confusedize_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
/usr/bin/kodi: line 219: 31310 Aborted                 (core dumped) ${KODI_BINARY} $SAVED_ARGS

This is crashing Kodi with 18.0-0.19.RC2 on Fedora 29 x64_86
It is reproducible every time when playing a YouTube clip (with the YouTube plug-in) (on stop or when the clip ends). It occasionally crashes Kodi also when scrolling through lists (of TV shows).
Also getting this exact same crash error if using Kodi 18 RC2 on Fedora 29 with the kodi-pvr-mythtv plugin.

Whenever the mythtv server sends a notification to the Kodi frontend the frontend crashes with the same error message as in the immediately proceeding post.

Also crashes at other random times with this error as well, but the mythtv notifications is repeatable.
I tried filing a bug with the rpmfusion packagers but bizarrely they didn't consider the program crashing to be a bug!

I worked out a fix...  following some Googling I found that the default settings for c++ changed in F28 and defines _GLIBCXX_ASSERTIONS by default.
Presumably the assertion in the code is to identify a problem but defining  _GLIBCXX_ASSERTIONS causes the program to exit when it is true. That might be useful for debugging but not for using the program!

The fix is to rebuild without the define by changing the CXXFLAGS
The default flags are shown with:
$ rpm --eval %configure
Build with:
$ rpm -ivh kodi-18.0-0.20.rc2.fc29.src.rpm 
$ export CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CXXFLAGS ; 
$ cd ~/rpmbuild/SPECS
$ sudo yum-builddep kodi.spec
$ rpmbuild -ba kodi.spec
removing the assertions is just a workaround. https://github.com/rpmfusion/kodi/commit...6b235e2516 is supposed to fix the issue, are you saying it doesn't for you?
(2018-12-15, 15:51)wsnipex Wrote: [ -> ]removing the assertions is just a workaround. https://github.com/rpmfusion/kodi/commit...6b235e2516 is supposed to fix the issue, are you saying it doesn't for you?

That patch was committed in April this year.

I've only started to see the crash since about 3 weeks back and now have it on two separate machines, both running Fedora29 x64, Kodi 18 RC2 from the rpmfusion repo.

So while there may be a view that the patch in April fixed a startup crash it's certainly not addressing the bug I reported a couple of posts back, Michaels post and potential fix deserves some further examination either at a coding or packaging level IMHO.
I think there may be several bugs that have the same symptoms.
My problem manifested itself when ending a YouTube video or when rapidly scrolling through movie titles.
Yes, I realize that this is not the fix for the bug but it makes the bug non-fatal. As I said, with the compiler flag _GLIBCXX_ASSERTIONS the assertion will guarantee kodi dies whereas it may have otherwise continued working.
In a non-debugging scenario I don't see the benefit of forcing the program to end with the assertion.

Here is my build if you want to try it ...
https://drive.google.com/drive/folders/1...2_-ObiPNrf
Please test https://github.com/xbmc/xbmc/pull/15104 and report back on GitHub
(2018-12-21, 12:38)yol Wrote: [ -> ]Please test https://github.com/xbmc/xbmc/pull/15104 and report back on GitHub

Willdo but am also waiting for kodi-pvr-mythtv to be updated in the rpmfusion repos as well.

https://bugzilla.rpmfusion.org/show_bug.cgi?id=5106
Hmm well as far as I can see no one here actually had the problem reported by the Fedora crash reporter (@Anothers has an unrelated PVR problem) and the one here had already been fixed, so disregard. I'll just merge #15104.
Pages: 1 2