Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 588678 - games-arcade/smc hangs; dev-games/cegui-0.6.2b runs an infinite loop with media-libs/freetype-2.6.3-r1
Summary: games-arcade/smc hangs; dev-games/cegui-0.6.2b runs an infinite loop with med...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-12 11:27 UTC by konsolebox
Modified: 2017-07-19 08:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description konsolebox 2016-07-12 11:27:15 UTC
After doing a world upgrade, games-arcade/smc suddenly stopped running properly.  `top` reports that it's using 100% CPU usage.

I examined it with gdb and saw the infinite loop:

(Using /etc/portage/env: CFLAGS="-ggdb -O -pipe"; CXXFLAGS=${CFLAGS}; FEATURES="${FEATURES} splitdebug installsources nostrip")

#0  0x00007ffff507cb13 in memset (__len=384, __ch=0, __dest=0x7fffffff6ef0) at /usr/include/bits/string3.h:90
#1  tt_loader_init (loader=loader@entry=0x7fffffff6ef0, size=size@entry=0xc392b0, glyph=glyph@entry=0xbc2eb0, load_flags=load_flags@entry=10283, 
    glyf_table_only=glyf_table_only@entry=0 '\000') at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/truetype/ttgload.c:2197
#2  0x00007ffff507d984 in TT_Load_Glyph (size=0xc392b0, glyph=0xbc2eb0, glyph_index=752, load_flags=10283)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/truetype/ttgload.c:2532
#3  0x00007ffff507dee3 in tt_glyph_load (ttslot=<optimized out>, ttsize=<optimized out>, glyph_index=<optimized out>, load_flags=<optimized out>)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/truetype/ttdriver.c:397
#4  0x00007ffff5067d4c in FT_Load_Glyph (face=face@entry=0xbc2700, glyph_index=glyph_index@entry=752, load_flags=10283, load_flags@entry=10273)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/base/ftobjs.c:742
#5  0x00007ffff50ad176 in af_loader_load_g (load_flags=<optimized out>, glyph_index=752, scaler=0x7fffffff71a0, loader=0x7fffffff71d0)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/autofit/afloader.c:114
#6  af_loader_load_glyph (load_flags=<optimized out>, gindex=752, face=<optimized out>, module=<optimized out>, loader=0x7fffffff71d0)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/autofit/afloader.c:538
#7  af_autofitter_load_glyph (module=<optimized out>, slot=<optimized out>, size=<optimized out>, glyph_index=752, load_flags=<optimized out>)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/autofit/afmodule.c:449
#8  0x00007ffff5067d20 in FT_Load_Glyph (face=face@entry=0xbc2700, glyph_index=<optimized out>, load_flags=load_flags@entry=32)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/base/ftobjs.c:733
#9  0x00007ffff5068246 in FT_Load_Char (face=0xbc2700, char_code=char_code@entry=831, load_flags=load_flags@entry=32)
    at /usr/src/debug/media-libs/freetype-2.6.3-r1/freetype-2.6.3/src/base/ftobjs.c:871
#10 0x00007ffff62853f5 in CEGUI::FreeTypeFont::updateFont (this=0xbcc1a0) at CEGUIFreeTypeFont.cpp:479
#11 0x00007ffff6283255 in CEGUI::FreeTypeFont::load (this=0xbcc1a0) at CEGUIFreeTypeFont.cpp:125
#12 0x00007ffff6282859 in CEGUI::Font_xmlHandler::elementFontEnd (this=this@entry=0x7fffffffbbb0) at CEGUIFont_xmlHandler.cpp:93
#13 0x00007ffff62829b5 in CEGUI::Font_xmlHandler::elementEnd (this=0x7fffffffbbb0, element=...) at CEGUIFont_xmlHandler.cpp:75
#14 0x00007fffebe63c6b in CEGUI::processXMLElement (handler=..., node=0xc32cf0) at CEGUILibxmlParser.cpp:77
#15 0x00007fffebe640f1 in CEGUI::LibxmlParser::parseXMLFile (this=<optimized out>, handler=..., filename=..., schemaName=..., resourceGroup=...)
    at CEGUILibxmlParser.cpp:118
#16 0x00007ffff627bd0e in CEGUI::FontManager::createFont (this=this@entry=0xbc0460, filename=..., resourceGroup=...) at CEGUIFontManager.cpp:103
#17 0x00007ffff6298d10 in CEGUI::Scheme::loadFonts (this=this@entry=0xbccfa0) at CEGUIScheme.cpp:235
#18 0x00007ffff629e1e2 in CEGUI::Scheme::loadResources (this=this@entry=0xbccfa0) at CEGUIScheme.cpp:120
#19 0x00007ffff629e7ee in CEGUI::Scheme::Scheme (this=0xbccfa0, filename=..., resourceGroup=...) at CEGUIScheme.cpp:92
#20 0x00007ffff629fd13 in CEGUI::SchemeManager::loadScheme (this=0xbc0700, scheme_filename=..., resourceGroup=...) at CEGUISchemeManager.cpp:81
#21 0x000000000055b586 in SMC::cVideo::Init_CEGUI_Data (this=<optimized out>) at video/video.cpp:245
#22 0x0000000000431f49 in SMC::Init_Game () at core/main.cpp:282
#23 0x00000000004362ce in main (argc=1, argv=<optimized out>) at core/main.cpp:179

After further examination, I found the actual loop which is in CEGUIFreeTypeFont.cpp:479 of dev-games/cegui.

    while (gindex)
    {
        if (max_codepoint < codepoint)
            max_codepoint = codepoint;

        // load-up required glyph metrics (don't render)
        if (FT_Load_Char(d_fontFace, codepoint,
                         FT_LOAD_DEFAULT | FT_LOAD_FORCE_AUTOHINT))
            continue; // glyph error

        float adv = d_fontFace->glyph->metrics.horiAdvance * float(FT_POS_COEF);

        // create a new empty FontGlyph with given character code
        d_cp_map[codepoint] = FontGlyph (adv);

        // proceed to next glyph
        codepoint = FT_Get_Next_Char (d_fontFace, codepoint, &gindex);
    }

The problem is that FT_Load_Char() would always return a nonzero which makes the loop always continue (glyph error).  `gindex` also stays nonzero.

I'm not sure if dev-games/cegui is the one that's wrong here, or media-libs/freetype.  I was planning to examine it further, but I decided to check my emerge.log file again.  This time I converted the UNIX timestamps to readable date format with `date -d @$T`, and saw that I actually made an update with media-libs/freetype during `emerge @world`.  The previous version before it was 2.5.5.  After installing that version, smc worked smoothly again.

TL;DR

The workaround is, don't use media-libs/freetype-2.6.3-r1.  `media-libs/freetype-2.5.5` seems to work fine.  I haven't tested media-libs/freetype-2.6.2.

I'm posting this for reference.  I don't intend to help fix it, or identify the real problem.
Comment 1 Mike Gilbert gentoo-dev 2016-07-16 16:37:29 UTC
> I'm posting this for reference.  I don't intend to help fix it, or identify
> the real problem.

Please do not treat our bug tracker as a personal bulletin board service. I you have no intention of interacting with developers, create a blog about it or something.
Comment 2 konsolebox 2016-07-16 18:02:32 UTC
(In reply to Mike Gilbert from comment #1)
> > I'm posting this for reference.  I don't intend to help fix it, or identify
> > the real problem.
> 
> Please do not treat our bug tracker as a personal bulletin board service. I
> you have no intention of interacting with developers, create a blog about it
> or something.

Yes I dislike collaborating, but this post still gives helpful information to those who would encounter the bug.
Comment 3 konsolebox 2016-07-16 19:50:34 UTC
This has been fixed in 2.6.4.

commit a7d8bdbcfeb65b4859fe553df9d4922627837888
Author: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Date:   Mon May 16 21:54:32 2016 +0900

    [truetype] Improve the recursive reference detector.
    
    The previous fix for #46372 misunderstood a composite glyph referring
    same component twice as a recursive reference.  See the discussion
    
    http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html
    
    Thanks to Khaled Hosny for finding this issue.
    
    * src/truetype/ttgload.c (ft_list_get_node_at): A function to get
    the i-th node from FT_List.  (load_truetype_glyph): In the traversal
    scan of the reference tree in the composite glyph, we clear the
    nodes filled by previous sibling chain.