Skip to content
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

stringrenderer_test failures #2302

Closed
stweil opened this issue Mar 8, 2019 · 5 comments
Closed

stringrenderer_test failures #2302

stweil opened this issue Mar 8, 2019 · 5 comments
Milestone

Comments

@stweil
Copy link
Member

stweil commented Mar 8, 2019

The test fails with a runtime error and several memory leaks if the code was built with sanitizers:

$ bin/ndebug/x86_64-linux-gnu,sanitize/unittest/stringrenderer_test 
Running main() from ../../../../unittest/../googletest/googletest/src/gtest_main.cc
[==========] Running 24 tests from 3 test suites.
[----------] Global test environment set-up.
[----------] 16 tests from StringRendererTest
[ RUN      ] StringRendererTest.DoesRenderToImage
[       OK ] StringRendererTest.DoesRenderToImage (95 ms)
[ RUN      ] StringRendererTest.DoesRenderToImageWithUnderline
[       OK ] StringRendererTest.DoesRenderToImageWithUnderline (12 ms)
[ RUN      ] StringRendererTest.DoesHandleNewlineCharacters
[       OK ] StringRendererTest.DoesHandleNewlineCharacters (3 ms)
[ RUN      ] StringRendererTest.DoesRenderLigatures
[       OK ] StringRendererTest.DoesRenderLigatures (5 ms)
[ RUN      ] StringRendererTest.ArabicBoxcharsInLTROrder
[       OK ] StringRendererTest.ArabicBoxcharsInLTROrder (3 ms)
[ RUN      ] StringRendererTest.DoesOutputBoxcharsInReadingOrder
[       OK ] StringRendererTest.DoesOutputBoxcharsInReadingOrder (9 ms)
[ RUN      ] StringRendererTest.DoesRenderVerticalText
[       OK ] StringRendererTest.DoesRenderVerticalText (8 ms)
[ RUN      ] StringRendererTest.DoesKeepAllImageBoxes
[       OK ] StringRendererTest.DoesKeepAllImageBoxes (6 ms)
[ RUN      ] StringRendererTest.DoesClearBoxes
[       OK ] StringRendererTest.DoesClearBoxes (7 ms)
[ RUN      ] StringRendererTest.DoesLigatureTextForRendering
../../../../../src/training/util.h:37:28: runtime error: left shift of negative value -17
[       OK ] StringRendererTest.DoesLigatureTextForRendering (4 ms)
[ RUN      ] StringRendererTest.DoesRetainInputLigatureForRendering
[       OK ] StringRendererTest.DoesRetainInputLigatureForRendering (2 ms)
[ RUN      ] StringRendererTest.DoesStripUnrenderableWords
Stripped 2 unrenderable words
[       OK ] StringRendererTest.DoesStripUnrenderableWords (0 ms)
[ RUN      ] StringRendererTest.DoesRenderWordBoxes
[       OK ] StringRendererTest.DoesRenderWordBoxes (3 ms)
[ RUN      ] StringRendererTest.DoesRenderWordBoxesFromMultiLineText
[       OK ] StringRendererTest.DoesRenderWordBoxesFromMultiLineText (2 ms)
[ RUN      ] StringRendererTest.DoesRenderAllFontsToImage
Total chars = 43
Arab : 43 hits = 100.00%, raw = 27 = 100.00%
Font Lohit Hindi failed with 8 hits = 18.60%
UnBatang : 43 hits = 100.00%, raw = 27 = 100.00%
Verdana : 43 hits = 100.00%, raw = 27 = 100.00%
[       OK ] StringRendererTest.DoesRenderAllFontsToImage (79 ms)
[ RUN      ] StringRendererTest.DoesNotRenderWordJoiner
[       OK ] StringRendererTest.DoesNotRenderWordJoiner (1 ms)
[----------] 16 tests from StringRendererTest (240 ms total)

[----------] 4 tests from ConvertBasicLatinToFullwidthLatinTest
[ RUN      ] ConvertBasicLatinToFullwidthLatinTest.DoesConvertBasicLatin
[       OK ] ConvertBasicLatinToFullwidthLatinTest.DoesConvertBasicLatin (0 ms)
[ RUN      ] ConvertBasicLatinToFullwidthLatinTest.DoesNotConvertFullwidthLatin
[       OK ] ConvertBasicLatinToFullwidthLatinTest.DoesNotConvertFullwidthLatin (0 ms)
[ RUN      ] ConvertBasicLatinToFullwidthLatinTest.DoesNotConvertNonLatin
[       OK ] ConvertBasicLatinToFullwidthLatinTest.DoesNotConvertNonLatin (0 ms)
[ RUN      ] ConvertBasicLatinToFullwidthLatinTest.DoesNotConvertSpace
[       OK ] ConvertBasicLatinToFullwidthLatinTest.DoesNotConvertSpace (0 ms)
[----------] 4 tests from ConvertBasicLatinToFullwidthLatinTest (1 ms total)

[----------] 4 tests from ConvertFullwidthLatinToBasicLatinTest
[ RUN      ] ConvertFullwidthLatinToBasicLatinTest.DoesConvertFullwidthLatin
[       OK ] ConvertFullwidthLatinToBasicLatinTest.DoesConvertFullwidthLatin (17 ms)
[ RUN      ] ConvertFullwidthLatinToBasicLatinTest.DoesNotConvertBasicLatin
[       OK ] ConvertFullwidthLatinToBasicLatinTest.DoesNotConvertBasicLatin (0 ms)
[ RUN      ] ConvertFullwidthLatinToBasicLatinTest.DoesNotConvertNonLatin
[       OK ] ConvertFullwidthLatinToBasicLatinTest.DoesNotConvertNonLatin (0 ms)
[ RUN      ] ConvertFullwidthLatinToBasicLatinTest.DoesNotConvertSpace
[       OK ] ConvertFullwidthLatinToBasicLatinTest.DoesNotConvertSpace (0 ms)
[----------] 4 tests from ConvertFullwidthLatinToBasicLatinTest (17 ms total)

[----------] Global test environment tear-down
[==========] 24 tests from 3 test suites ran. (260 ms total)
[  PASSED  ] 24 tests.

  YOU HAVE 1 DISABLED TEST


=================================================================
==16120==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 49920 byte(s) in 78 object(s) allocated from:
    #0 0x7fc23e52b740 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9740)
    #1 0x7fc23c02d780  (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20780)

Direct leak of 1024 byte(s) in 4 object(s) allocated from:
    #0 0x7fc23e52b350 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9350)
    #1 0x7fc23c02d6d4  (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x206d4)

Indirect leak of 45216 byte(s) in 1413 object(s) allocated from:
    #0 0x7fc23e52b538 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9538)
    #1 0x7fc23c02dd18  (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20d18)

Indirect leak of 27136 byte(s) in 848 object(s) allocated from:
    #0 0x7fc23e52b538 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9538)
    #1 0x7fc23c02d27c  (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2027c)

Indirect leak of 11262 byte(s) in 1241 object(s) allocated from:
    #0 0x7fc23e47c810 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3a810)
    #1 0x7fc23c02cfc4 in FcValueSave (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1ffc4)

Indirect leak of 10304 byte(s) in 322 object(s) allocated from:
    #0 0x7fc23e52b538 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9538)
    #1 0x7fc23c02d177  (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20177)

Indirect leak of 7488 byte(s) in 234 object(s) allocated from:
    #0 0x7fc23e52b538 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9538)
    #1 0x7fc23c02d106  (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20106)

Indirect leak of 1872 byte(s) in 39 object(s) allocated from:
    #0 0x7fc23e52b350 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9350)
    #1 0x7fc23c0272ed in FcLangSetCreate (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1a2ed)

SUMMARY: AddressSanitizer: 154222 byte(s) leaked in 4179 allocation(s).
@stweil stweil added this to the 4.1.0 milestone Mar 8, 2019
@Shreeshrii
Copy link
Collaborator

Related ... Memory leaks related to stringrenderer when running text2image.

Please see #1781 (comment)

@stweil
Copy link
Member Author

stweil commented Mar 31, 2019

The leaks are related to libfontconfig, and it looks like there is no solution to fix them. So the only solution is ignoring those leaks.

For the LeakSanitizer (part of the AdressSanitizer) this can be done like this:

# Set name of file with suppression rules.
export LSAN_OPTIONS=suppressions=LEAKFILE

The file LEAKFILE (use any absolute filename) includes the rules for suppressions. The following rule works on Debian:

leak:libfontconfig

It ignores leaks caused by libfontconfig. Maybe make check can be modified to do this automatically.

@zdenop
Copy link
Contributor

zdenop commented May 25, 2019

is this solved?

@stweil stweil modified the milestones: 4.1.1, 5.0.0 Dec 22, 2020
@stweil
Copy link
Member Author

stweil commented Dec 22, 2020

This issue was solved by pull request #3171.

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

No branches or pull requests

4 participants