Leon0824 / rimeime

Automatically exported from code.google.com/p/rimeime
0 stars 0 forks source link

rime_test segfaults randomly #633

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

With BUILD_TEST=ON, rime_test fails with a probability of about 1/2.

rime version: 1.2

$ gdb rime_test
...
(gdb) run --gtest_shuffle
Starting program: librime-rime-1.2/debug-build/test/rime_test --gtest_shuffle
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Note: Randomizing tests' orders with a seed of 76765 .
[==========] Running 65 tests from 20 test cases.
[----------] Global test environment set-up.
[----------] 1 test from RimeConfigItemTest
[ RUN      ] RimeConfigItemTest.NullItem
[       OK ] RimeConfigItemTest.NullItem (0 ms)
[----------] 1 test from RimeConfigItemTest (0 ms total)

[----------] 6 tests from RimeSyllabifierTest
[ RUN      ] RimeSyllabifierTest.CaseAlpha
[       OK ] RimeSyllabifierTest.CaseAlpha (1 ms)
[ RUN      ] RimeSyllabifierTest.CaseChainingAmbiguity
[       OK ] RimeSyllabifierTest.CaseChainingAmbiguity (1 ms)
[ RUN      ] RimeSyllabifierTest.CaseFailure
[       OK ] RimeSyllabifierTest.CaseFailure (0 ms)
[ RUN      ] RimeSyllabifierTest.TransposedSyllableGraph
[       OK ] RimeSyllabifierTest.TransposedSyllableGraph (0 ms)
[ RUN      ] RimeSyllabifierTest.CaseChangan
[       OK ] RimeSyllabifierTest.CaseChangan (1 ms)
[ RUN      ] RimeSyllabifierTest.CaseTuan
[       OK ] RimeSyllabifierTest.CaseTuan (0 ms)
[----------] 6 tests from RimeSyllabifierTest (3 ms total)

[----------] 9 tests from RimeKeyEventTest
[ RUN      ] RimeKeyEventTest.BadKeyName
[       OK ] RimeKeyEventTest.BadKeyName (0 ms)
[ RUN      ] RimeKeyEventTest.Serialization
[       OK ] RimeKeyEventTest.Serialization (0 ms)
[ RUN      ] RimeKeyEventTest.KeyName
[       OK ] RimeKeyEventTest.KeyName (0 ms)
[ RUN      ] RimeKeyEventTest.ConstructKeyEventFromRepresentation
[       OK ] RimeKeyEventTest.ConstructKeyEventFromRepresentation (0 ms)
[ RUN      ] RimeKeyEventTest.ModifiedKeyEvent
[       OK ] RimeKeyEventTest.ModifiedKeyEvent (0 ms)
[ RUN      ] RimeKeyEventTest.HexKeyName
[       OK ] RimeKeyEventTest.HexKeyName (0 ms)
[ RUN      ] RimeKeyEventTest.Equality
[       OK ] RimeKeyEventTest.Equality (0 ms)
[ RUN      ] RimeKeyEventTest.ParseKeyEventRepresentation
[       OK ] RimeKeyEventTest.ParseKeyEventRepresentation (0 ms)
[ RUN      ] RimeKeyEventTest.ModifiedKeyEventRepresentation
[       OK ] RimeKeyEventTest.ModifiedKeyEventRepresentation (0 ms)
[----------] 9 tests from RimeKeyEventTest (1 ms total)

[----------] 1 test from RimeConfigWriterTest
[ RUN      ] RimeConfigWriterTest.Greetings
[       OK ] RimeConfigWriterTest.Greetings (2 ms)
[----------] 1 test from RimeConfigWriterTest (2 ms total)

[----------] 1 test from RimeConfigListKeyPathTest
[ RUN      ] RimeConfigListKeyPathTest.Greetings
[       OK ] RimeConfigListKeyPathTest.Greetings (1 ms)
[----------] 1 test from RimeConfigListKeyPathTest (1 ms total)

[----------] 5 tests from RimeCalculusTest
[ RUN      ] RimeCalculusTest.Erasion
[       OK ] RimeCalculusTest.Erasion (0 ms)
[ RUN      ] RimeCalculusTest.Derivation
[       OK ] RimeCalculusTest.Derivation (0 ms)
[ RUN      ] RimeCalculusTest.Transliteration
[       OK ] RimeCalculusTest.Transliteration (0 ms)
[ RUN      ] RimeCalculusTest.Abbreviation
[       OK ] RimeCalculusTest.Abbreviation (0 ms)
[ RUN      ] RimeCalculusTest.Transformation
[       OK ] RimeCalculusTest.Transformation (1 ms)
[----------] 5 tests from RimeCalculusTest (1 ms total)

[----------] 2 tests from RimeAlgebraTest
[ RUN      ] RimeAlgebraTest.SpellingManipulation
[       OK ] RimeAlgebraTest.SpellingManipulation (0 ms)
[ RUN      ] RimeAlgebraTest.Projection
[       OK ] RimeAlgebraTest.Projection (0 ms)
[----------] 2 tests from RimeAlgebraTest (0 ms total)

[----------] 3 tests from RimeTableTest
[ RUN      ] RimeTableTest.QueryWithSyllableGraph

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff796f41d in rime::TableQuery::Access (this=0x7fffffffd6a0, 
syllable_id=1, credibility=1)
    at librime-rime-1.2/src/dict/table.cc:225
225             syllable_id >= static_cast<SyllableId>(lv1_index_->size))
(gdb) bt
#0  0x00007ffff796f41d in rime::TableQuery::Access (this=0x7fffffffd6a0, 
syllable_id=1, credibility=1)
    at librime-rime-1.2/src/dict/table.cc:225
#1  0x00007ffff79721ae in rime::Table::Query (this=0x7ff3e0, syll_graph=..., 
start_pos=0, result=0x7fffffffd8d0)
    at librime-rime-1.2/src/dict/table.cc:648
#2  0x0000000000531b25 in RimeTableTest_QueryWithSyllableGraph_Test::TestBody 
(this=0x7f9100)
    at librime-rime-1.2/test/table_test.cc:184
#3  0x0000000000589e18 in void 
testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, 
void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#4  0x0000000000585550 in void 
testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, 
void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#5  0x000000000056d1d3 in testing::Test::Run() ()
#6  0x000000000056d9b9 in testing::TestInfo::Run() ()
#7  0x000000000056e04a in testing::TestCase::Run() ()
#8  0x00000000005748f1 in testing::internal::UnitTestImpl::RunAllTests() ()
#9  0x000000000058b108 in bool 
testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::Uni
tTestImpl, bool>(testing::internal::UnitTestImpl*, bool 
(testing::internal::UnitTestImpl::*)(), char const*) ()
#10 0x000000000058623e in bool 
testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTe
stImpl, bool>(testing::internal::UnitTestImpl*, bool 
(testing::internal::UnitTestImpl::*)(), char const*) ()
#11 0x000000000057352d in testing::UnitTest::Run() ()
#12 0x000000000055b9d6 in RUN_ALL_TESTS () at /usr/include/gtest/gtest.h:2288
#13 0x000000000055b971 in main (argc=1, argv=0x7fffffffe618) at 
librime-rime-1.2/test/rime_test_main.cc:8
(gdb)

Original issue reported on code.google.com by culu....@gmail.com on 18 Jul 2014 at 2:15

GoogleCodeExporter commented 9 years ago
ps. This is on a normal x86_64 (amd64) linux system. (debian sid)

Original comment by culu....@gmail.com on 18 Jul 2014 at 2:16

GoogleCodeExporter commented 9 years ago
This is weird.
I cannot reproduce the error on Ubuntu 14.04 (amd64).

But when I was developing the new binary table format, I did ran into errors 
repeatedly, when I had *.bin files generated by a previous version of 
rime_test. After removing all the old .bin files the test succeeded.
Is it the case with you? Then try to rm path_to_the_build/test/*.bin ; though I 
think this shouldn't had caused the error because the test would remove the old 
table file on setup...

Original comment by chen....@gmail.com on 18 Jul 2014 at 3:21

GoogleCodeExporter commented 9 years ago
Hey, what's "--gtest_shuffle"?

Original comment by chen....@gmail.com on 18 Jul 2014 at 3:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was wrong.
With the new binary format, a Table is not ready for reading after 
Table::Build(); in order to do queries we need to reopen the table with 
Table::Load().
That's why the test succeeds only if RimeTableTest.IntegrityTest is run before 
any query method is tested. I'll try to fix it.
Thanks.

Original comment by chen....@gmail.com on 18 Jul 2014 at 3:44

GoogleCodeExporter commented 9 years ago
Fixed in this commit 
https://github.com/lotem/librime/commit/c1f5240b601a9020b85f94a4882f0b64912e57e9

The bug long exists in rime_test itself. I think this won't mark the 1.2 
release flawed.

Original comment by chen....@gmail.com on 18 Jul 2014 at 6:11