RTINDEX - GROUP N BY fatal crash

I have come to this issue with 3.5.2. Manticore crashes when query is used with
“GROUP N BY”. Crash is occruing only when N > 1.

So with " GROUP 1 BY" its OK.
So with " GROUP 5 BY" its CRASH.

Example query follow bellow.

FROM test_index 
    MATCH('@t s389962')
GROUP 10 BY pt

backtrace from log
-------------- backtrace begins here ---------------
Program compiled with 4.8.5
Configured with flags: Configured by CMake with these definitions: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDISTR_BUILD=rhel7 -DUSE_SSL=ON -DDL_UNIXODBC=1 -DUNIXODBC_LIB=libodbc.so.2 -DDL_EXPAT=1 -DEXPAT_LIB=libexpat.so.1 -DUSE_LIBICONV=1 -DDL_MYSQL=1 -DMYSQL_LIB=libmysqlclient.so.18 -DDL_PGSQL=1 -DPGSQL_LIB=libpq.so.5 -DLOCALDATADIR=/var/data -DFULL_SHARE_DIR=/usr/share/manticore -DUSE_RE2=1 -DUSE_ICU=1 -DUSE_BISON=ON -DUSE_FLEX=ON -DUSE_SYSLOG=1 -DWITH_EXPAT=1 -DWITH_ICONV=ON -DWITH_MYSQL=1 -DWITH_ODBC=ON -DWITH_PGSQL=1 -DWITH_RE2=1 -DWITH_STEMMER=1 -DWITH_ZLIB=ON -DGALERA_SONAME=libgalera_manticore.so.31 -DSYSCONFDIR=/etc/manticoresearch
Host OS is Linux x86_64
Stack bottom = 0x7f41b4023c60, thread stack size = 0x20000
Trying manual backtrace:
Something wrong with thread stack, manual backtrace may be incorrect (fp=0x5956f0)
Wrong stack limit or frame pointer, manual backtrace failed (fp=0x5956f0, stack=0x7f41b4020000, stacksize=0x20000)
Trying system backtrace:
begin of system symbols:
-------------- backtrace ends here ---------------

could you check your index with indextool then in case test passed well create ticket at Github there upload your index data that recreates this crash locally?

It’s a RT index… so indextool will not help me much, right?
I did complete index recreate before testing, its about 450MB index size.

I hope the stack trace will be helpful, I will try to prepare recreate case though.
Few notices:

  • Manticore 3.1. is working OK with these queries
  • The rt index in crash case does not fit to RAM chunk, its split over over couple 200MB .*spX

It’s a RT index… so indextool will not help me much, right?

Indextool can check RT indexes too.

I did complete index recreate before testing, its about 450MB index size.

That’s great, tit should be easy to fix it then if you share the index. You can upload it to our write-only FTP https://manual.manticoresearch.com/Reporting_bugs#Uploading-your-data

I perfomed indextool check, got this message:
WARNING: failed to load RAM chunks, checking only 1 disk chunks
could that be related?

I also noticed, what causes the crash:

this query is OK:

    id, pt
FROM crash_index
WHERE MATCH('@t s9413')
GROUP 2 BY pt;

this query is CRASH:

    (1+2) AS test_expr
FROM crash_index
WHERE MATCH('@t s9413')
GROUP 2 BY pt;

To me, it’s obvious, that adding a expresion to select query causes the crash.

We have GROUP N BY tests and I added case that you described there

sphinxql-1> select id, (1+2) AS test_expr from idx_factors_rev where match ('this') group 2 by gid;
	id	test_expr
	1	3
	2	3
	5	3

and see no crashes - all works well.

That is why I need reproducible example or data there crash happens to investigate this issue further.

No that is not related to crash. That means that indextool sees daemon running and checks only disk backed chunks of RT index but not whole RT index.

You are correct,
I also noticed it does not happen on small rt index, so case test passes OK.
Must be somehow related to chunked larger index or to this specific data structure.

I created https://github.com/manticoresoftware/manticoresearch/issues/435
Data will be uploaded within 10minutes, 599MB. Full RT index.

I’ve just fixed this crash at master branch e6424a13. You could use binaries from dev repo after CI will finish to get issue fixed.

1 Like

I wanted to thank you. After this bugfix I was able to upgrade to version 3.5.4 (from 3.2) and after 10 days in live production everything seems perfectly stable for us. We use only RT indexes.

  • memory leaks gone during “flush rtindex”
  • index size is smaller and queries are faster

I am looking forward to next great updates!

Only “strange” thing for me is this issue “‘data_dir’ cannot be mixed with index declarations”. Since we use script generated indexes and move eveything to “live” index declarations seems somehow unreal at this moment, se we can’t use new RT features yet.

1 Like