join search crashed when using string not int
Bug Description:
docker compose config:
manticore:
container_name: manticore
image: manticoresearch/manticore:7.4.6
environment:
- EXTRA=1
- searchd_binlog_path=
restart: always
ports:
- 9306:9306
- 9308:9308
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
memlock:
soft: -1
hard: -1
volumes:
- manticore_data:/var/lib/manticore
create table products (name string, info text, price integer) morphology = 'stem_en';
insert into products (id, name, info, price) values (1, 'Product 1', 'First demo product, small', 10);
create table basket (user_id integer, product_code integer, product_name string, count integer);
insert into basket (user_id, product_code, product_name, count) values (1, 1, 'Product 1', 1);
select name, info, price, basket.count, basket.user_id
from products left join basket on basket.product_name = products.name;
Manticore Search Version:
7.4.6 b2ff82920@25022808
Operating System Version:
Ubuntu 16.04.6 LTS
Have you tried the latest development version?
None
Internal Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.
- [ ] Implementation completed
- [ ] Tests developed
- [ ] Documentation updated
- [ ] Documentation reviewed
- [ ] Changelog updated
Thanks @shellphy
MRE - it crashes on an attempt to join by a string attribute:
mysql -v -P9306 -h0 -e "drop table if exists t; create table t (s string); insert into t (s) values ('s'); drop table if exists t2; create table t2 (s string); insert into t2 (s) values ('s'); select s from t left join t2 on t.s = t2.s;"
--------------
drop table if exists t
--------------
--------------
create table t (s string)
--------------
--------------
insert into t (s) values ('s')
--------------
--------------
drop table if exists t2
--------------
--------------
create table t2 (s string)
--------------
--------------
insert into t2 (s) values ('s')
--------------
--------------
select s from t left join t2 on t.s = t2.s
--------------
ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query
Reproduced in the latest dev.
I have the same behavior. Docker image tag: 9.2.14
------- FATAL: CRASH DUMP -------
[Wed Apr 9 11:29:01.679 2025] [ 1]
--- crashed SphinxQL request dump ---
select code from products inner join templates on templates.code = products.template_code
--- request dump end ---
--- local index:products
Manticore 9.2.14 23296c0f8@25032816 (columnar 4.2.0 417f074@25032808) (secondary 4.2.0 417f074@25032808) (knn 4.2.0 417f074@25032808)
Handling signal 11
-------------- backtrace begins here ---------------
Program compiled with Clang 16.0.6
Configured with flags: Configured with these definitions: -DDISTR_BUILD=jammy -DUSE_SYSLOG=1 -DWITH_GALERA=1 -DWITH_RE2=1 -DWITH_RE2_FORCE_STATIC=1 -DWITH_STEMMER=1 -DWITH_STEMMER_FORCE_STATIC=1 -DWITH_NLJSON=1 -DWITH_UNIALGO=1 -DWITH_ICU=1 -DWITH_ICU_FORCE_STATIC=1 -DWITH_JIEBA=1 -DWITH_SSL=1 -DWITH_ZLIB=1 -DWITH_ZSTD=1 -DDL_ZSTD=1 -DZSTD_LIB=libzstd.so.1 -DWITH_CURL=1 -DDL_CURL=1 -DCURL_LIB=libcurl.so.4 -DWITH_ODBC=1 -DDL_ODBC=1 -DODBC_LIB=libodbc.so.2 -DWITH_EXPAT=1 -DDL_EXPAT=1 -DEXPAT_LIB=libexpat.so.1 -DWITH_ICONV=1 -DWITH_MYSQL=1 -DDL_MYSQL=1 -DMYSQL_LIB=libmysqlclient.so.21 -DWITH_POSTGRESQL=1 -DDL_POSTGRESQL=1 -DPOSTGRESQL_LIB=libpq.so.5 -DLOCALDATADIR=/var/lib/manticore -DFULL_SHARE_DIR=/usr/share/manticore
Built on Linux x86_64 (jammy) (cross-compiled)
Stack bottom = 0x7f0648063fc0, thread stack size = 0x20000
Trying manual backtrace:
Something wrong with thread stack, manual backtrace may be incorrect (fp=0x20000)
Wrong stack limit or frame pointer, manual backtrace failed (fp=0x20000, stack=0x7f0648060000, stacksize=0x20000)
Trying system backtrace:
begin of system symbols:
searchd(_Z12sphBacktraceib+0x227)[0x55dc15fab1e7]
searchd(_ZN11CrashLogger11HandleCrashEi+0x364)[0x55dc15e21c54]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f06b6242520]
searchd(_ZN12JoinSorter_c28SetupRightStandaloneLocatorsEv+0xad)[0x55dc1624259d]
searchd(_ZN12JoinSorter_c18SetupJoinAttrRemapEv+0x388)[0x55dc16242988]
searchd(_ZN12JoinSorter_c14RunJoinedQueryERi+0x2ab)[0x55dc1624355b]
searchd(_ZN12JoinSorter_c33RunJoinedQueryAndAdjustMaxMatchesEv+0x20)[0x55dc16243690]
searchd(_ZN12JoinSorter_c13RunFinalBatchEv+0x3a)[0x55dc162446aa]
searchd(_ZN12JoinSorter_c12FinalizeJoinER10CSphStringS1_+0x20)[0x55dc162462c0]
searchd(_ZNK13CSphIndex_VLN9MultiScanER15CSphQueryResultRK9CSphQueryRK11VecTraits_TIP15ISphMatchSorterERK18CSphMultiQueryArgsl+0x863)[0x55dc15ed5903]
searchd(_ZNK13CSphIndex_VLN10MultiQueryER15CSphQueryResultRK9CSphQueryRK11VecTraits_TIP15ISphMatchSorterERK18CSphMultiQueryArgs+0x92d)[0x55dc15eded7d]
searchd(+0x1326cd6)[0x55dc160b9cd6]
searchd(+0x144466d)[0x55dc161d766d]
searchd(_ZN7Threads4Coro8ExecuteNEiOSt8functionIFvvEE+0x7a)[0x55dc1702796a]
searchd(_ZNK9RtIndex_c10MultiQueryER15CSphQueryResultRK9CSphQueryRK11VecTraits_TIP15ISphMatchSorterERK18CSphMultiQueryArgs+0xf75)[0x55dc160a84f5]
searchd(_ZNK13CSphIndexStub12MultiQueryExEiPK9CSphQueryP15CSphQueryResultPP15ISphMatchSorterRK18CSphMultiQueryArgs+0x70)[0x55dc15e0ef90]
searchd(+0x10f9771)[0x55dc15e8c771]
searchd(+0x144466d)[0x55dc161d766d]
searchd(_ZN7Threads4Coro8ExecuteNEiOSt8functionIFvvEE+0x7a)[0x55dc1702796a]
searchd(_ZN15SearchHandler_c16RunLocalSearchesEv+0x751)[0x55dc15e38011]
searchd(_ZN15SearchHandler_c9RunSubsetEii+0x533)[0x55dc15e39553]
searchd(_ZN15SearchHandler_c10RunQueriesEv+0xa8)[0x55dc15e36448]
searchd(_Z17HandleMysqlSelectR11RowBuffer_iR15SearchHandler_c+0x158)[0x55dc15e5fdb8]
searchd(_ZN15ClientSession_c7ExecuteESt4pairIPKciER11RowBuffer_i+0x1bc4)[0x55dc15e6e204]
searchd(_Z8SqlServeSt10unique_ptrI16AsyncNetBuffer_cSt14default_deleteIS0_EE+0x18b0)[0x55dc15d79740]
searchd(_Z10MultiServeSt10unique_ptrI16AsyncNetBuffer_cSt14default_deleteIS0_EESt4pairIitE7Proto_e+0x43)[0x55dc15d74103]
searchd(+0xfe1c92)[0x55dc15d74c92]
searchd(_ZZN7Threads11CoRoutine_c13CreateContextESt8functionIFvvEESt4pairIN5boost7context13stack_contextENS_14StackFlavour_EEEENUlNS6_6detail10transfer_tEE_8__invokeESB_+0x1c)[0x55dc1702a7bc]
searchd(make_fcontext+0x37)[0x55dc173a85d7]
Trying boost backtrace:
0# sphBacktrace(int, bool) in searchd
1# CrashLogger::HandleCrash(int) in searchd
2# 0x00007F06B6242520 in /lib/x86_64-linux-gnu/libc.so.6
3# JoinSorter_c::SetupRightStandaloneLocators() in searchd
4# JoinSorter_c::SetupJoinAttrRemap() in searchd
5# JoinSorter_c::RunJoinedQuery(int&) in searchd
6# JoinSorter_c::RunJoinedQueryAndAdjustMaxMatches() in searchd
7# JoinSorter_c::RunFinalBatch() in searchd
8# JoinSorter_c::FinalizeJoin(CSphString&, CSphString&) in searchd
9# CSphIndex_VLN::MultiScan(CSphQueryResult&, CSphQuery const&, VecTraits_T<ISphMatchSorter*> const&, CSphMultiQueryArgs const&, long) const in searchd
10# CSphIndex_VLN::MultiQuery(CSphQueryResult&, CSphQuery const&, VecTraits_T<ISphMatchSorter*> const&, CSphMultiQueryArgs const&) const in searchd
11# 0x000055DC160B9CD6 in searchd
12# 0x000055DC161D766D in searchd
13# Threads::Coro::ExecuteN(int, std::function<void ()>&&) in searchd
14# RtIndex_c::MultiQuery(CSphQueryResult&, CSphQuery const&, VecTraits_T<ISphMatchSorter*> const&, CSphMultiQueryArgs const&) const in searchd
15# CSphIndexStub::MultiQueryEx(int, CSphQuery const*, CSphQueryResult*, ISphMatchSorter**, CSphMultiQueryArgs const&) const in searchd
16# 0x000055DC15E8C771 in searchd
17# 0x000055DC161D766D in searchd
18# Threads::Coro::ExecuteN(int, std::function<void ()>&&) in searchd
19# SearchHandler_c::RunLocalSearches() in searchd
20# SearchHandler_c::RunSubset(int, int) in searchd
21# SearchHandler_c::RunQueries() in searchd
22# HandleMysqlSelect(RowBuffer_i&, SearchHandler_c&) in searchd
23# ClientSession_c::Execute(std::pair<char const*, int>, RowBuffer_i&) in searchd
24# SqlServe(std::unique_ptr<AsyncNetBuffer_c, std::default_delete<AsyncNetBuffer_c> >) in searchd
25# MultiServe(std::unique_ptr<AsyncNetBuffer_c, std::default_delete<AsyncNetBuffer_c> >, std::pair<int, unsigned short>, Proto_e) in searchd
26# 0x000055DC15D74C92 in searchd
27# Threads::CoRoutine_c::CreateContext(std::function<void ()>, std::pair<boost::context::stack_context, Threads::StackFlavour_E>)::{lambda(boost::context::detail::transfer_t)#1}::__invoke(boost::context::detail::transfer_t) in searchd
28# make_fcontext in searchd
-------------- backtrace ends here ---------------
I think I have a similar issue that I triggers with LEFT and INNER JOIN. Oddly, I can run the query once from the MySQL prompt and it will work once and then the second time it crashes.
`--- crashed HTTP request dump ---
SELECT
application_id,
patent_id,
text_content,
section_type,
patent_biblio.title,
patent_biblio.inventors,
patent_biblio.applicant_name,
patent_biblio.applicant_org_name,
patent_biblio.examiners,
patent_biblio.pub_date_timestamp,
patent_biblio.file_date_timestamp,
patent_biblio.issue_date_timestamp,
patent_biblio.kind,
patent_biblio.uspc_symbol,
patent_biblio.app_type,
patent_biblio.publication_id,
HIGHLIGHT({around=10, before_match='<mark class="bg-amber-200 text-amber-900">', after_match='</mark>'}) as highlight
FROM patent
INNER JOIN patent_biblio ON patent.application_id = patent_biblio.application_id
WHERE MATCH('cyber', patent)
LIMIT 0, 25
--- request dump end --- --- local index:patent_04 Manticore 13.6.7 1ab9ccc95@25080704 (columnar 8.0.1 fc30df6@25072219) (secondary 8.0.1 fc30df6@25072219) (knn 8.0.1 fc30df6@25072219) (embeddings 1.0.0) Handling signal 11 -------------- backtrace begins here --------------- Program compiled with Clang 16.0.6 Configured with flags: Configured with these definitions: -DDISTR_BUILD=jammy -DUSE_SYSLOG=1 -DWITH_GALERA=1 -DWITH_RE2=1 -DWITH_RE2_FORCE_STATIC=1 -DWITH_STEMMER=1 -DWITH_STEMMER_FORCE_STATIC=1 -DWITH_NLJSON=1 -DWITH_UNIALGO=1 -DWITH_ICU=1 -DWITH_ICU_FORCE_STATIC=1 -DWITH_JIEBA=1 -DWITH_SSL=1 -DWITH_ZLIB=1 -DWITH_ZSTD=1 -DDL_ZSTD=1 -DZSTD_LIB=libzstd.so.1 -DWITH_CURL=1 -DDL_CURL=1 -DCURL_LIB=libcurl.so.4 -DWITH_ODBC=1 -DDL_ODBC=1 -DODBC_LIB=libodbc.so.2 -DWITH_EXPAT=1 -DDL_EXPAT=1 -DEXPAT_LIB=libexpat.so.1 -DWITH_ICONV=1 -DWITH_MYSQL=1 -DDL_MYSQL=1 -DMYSQL_LIB=libmysqlclient.so.21 -DWITH_POSTGRESQL=1 -DDL_POSTGRESQL=1 -DPOSTGRESQL_LIB=libpq.so.5 -DLOCALDATADIR=/var/lib/manticore -DFULL_SHARE_DIR=/usr/share/manticore Built on Linux x86_64 (jammy) (cross-compiled) Stack bottom = 0x7bb2801f10c0, thread stack size = 0x20000 Trying manual backtrace: Something wrong with thread stack, manual backtrace may be incorrect (fp=0x20000) Wrong stack limit or frame pointer, manual backtrace failed (fp=0x20000, stack=0x7bb2801f0000, stacksize=0x20000) Trying system backtrace: begin of system symbols: /usr/bin/searchd(_Z12sphBacktraceib+0x227)[0x632b860071c7] /usr/bin/searchd(_Z11HandleCrashi+0x2e3)[0x632b85d50663] /lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x7bb2d7e45330] /usr/bin/searchd(_ZN12JoinSorter_c28SetupRightStandaloneLocatorsEv+0xad)[0x632b862adf5d] /usr/bin/searchd(_ZN12JoinSorter_c18SetupJoinAttrRemapEv+0x391)[0x632b862ae351] /usr/bin/searchd(_ZN12JoinSorter_c14RunJoinedQueryERi+0x2ad)[0x632b862aee2d] /usr/bin/searchd(_ZN12JoinSorter_c33RunJoinedQueryAndAdjustMaxMatchesEv+0x20)[0x632b862aefa0] /usr/bin/searchd(_ZN12JoinSorter_c4PushERK9CSphMatch+0x30b7)[0x632b862c6227] /usr/bin/searchd(_ZNK13CSphIndex_VLN13MatchExtendedILb1ELb0ELb0ELb0ELb0ELb0ELb0EEEvR16CSphQueryContextRK9CSphQueryRK11VecTraits_TIP15ISphMatchSorterEP10ISphRankeriii+0x13d)[0x632b85fced4d] /usr/bin/searchd(_ZNK13CSphIndex_VLN16ParsedMultiQueryERK9CSphQueryR15CSphQueryResultRK11VecTraits_TIP15ISphMatchSorterERK9XQQuery_t17CSphRefcountedPtrI8CSphDictERK18CSphMultiQueryArgsP18CSphQueryNodeCachel+0x195d)[0x632b85f3786d] /usr/bin/searchd(+0x1243381)[0x632b85fb1381] /usr/bin/searchd(_ZNK13CSphIndex_VLN19RunParsedMultiQueryEiR17CSphRefcountedPtrI8CSphDictEbRK9CSphQueryR15CSphQueryResultR11VecTraits_TIP15ISphMatchSorterERK9XQQuery_tRK18CSphMultiQueryArgsl+0x103)[0x632b85f32c93] /usr/bin/searchd(+0x1245b89)[0x632b85fb3b89] /usr/bin/searchd(+0x14d0d32)[0x632b8623ed32] /usr/bin/searchd(ZZN7Threads11CoRoutine_c13CreateContextESt8functionIFvvEESt4pairIN5boost7context13stack_contextENS_14StackFlavour_EEEENUlNS6_6detail10transfer_tEE_8__invokeESB+0x1c)[0x632b8713e4fc] /usr/bin/searchd(make_fcontext+0x37)[0x632b874be107] Trying boost backtrace: 0# sphBacktrace(int, bool) in /usr/bin/searchd 1# HandleCrash(int) in /usr/bin/searchd 2# 0x00007BB2D7E45330 in /lib/x86_64-linux-gnu/libc.so.6 3# JoinSorter_c::SetupRightStandaloneLocators() in /usr/bin/searchd 4# JoinSorter_c::SetupJoinAttrRemap() in /usr/bin/searchd 5# JoinSorter_c::RunJoinedQuery(int&) in /usr/bin/searchd 6# JoinSorter_c::RunJoinedQueryAndAdjustMaxMatches() in /usr/bin/searchd 7# JoinSorter_c::Push(CSphMatch const&) in /usr/bin/searchd 8# void CSphIndex_VLN::MatchExtended<true, false, false, false, false, false, false>(CSphQueryContext&, CSphQuery const&, VecTraits_T<ISphMatchSorter*> const&, ISphRanker*, int, int, int) const in /usr/bin/searchd 9# CSphIndex_VLN::ParsedMultiQuery(CSphQuery const&, CSphQueryResult&, VecTraits_T<ISphMatchSorter*> const&, XQQuery_t const&, CSphRefcountedPtr<CSphDict>, CSphMultiQueryArgs const&, CSphQueryNodeCache*, long) const in /usr/bin/searchd 10# 0x0000632B85FB1381 in /usr/bin/searchd 11# CSphIndex_VLN::RunParsedMultiQuery(int, CSphRefcountedPtr<CSphDict>&, bool, CSphQuery const&, CSphQueryResult&, VecTraits_T<ISphMatchSorter*>&, XQQuery_t const&, CSphMultiQueryArgs const&, long) const in /usr/bin/searchd 12# 0x0000632B85FB3B89 in /usr/bin/searchd 13# 0x0000632B8623ED32 in /usr/bin/searchd 14# Threads::CoRoutine_c::CreateContext(std::function<void ()>, std::pair<boost::context::stack_context, Threads::StackFlavour_E>)::{lambda(boost::context::detail::transfer_t)#1}::__invoke(boost::context::detail::transfer_t) in /usr/bin/searchd 15# make_fcontext in /usr/bin/searchd
-------------- backtrace ends here ---------------`
Works fine in 13.11.1