stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
857 stars 140 forks source link

bug: 在执行查询时服务器崩溃在了 Tianmu::mm::TCMHeap::dealloc #1932

Open adofsauron opened 1 year ago

adofsauron commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

SELECT com_md_code,
       ......
  FROM xxx
 WHERE (c_card = '8880006639')
 ORDER BY c_card_jf_date DESC LIMIT 100;
......
100 rows in set (5.08 sec)

SELECT com_md_code,
       ......
  FROM xxx
 WHERE (c_card = '8880006639')
 ORDER BY c_card_jf_date DESC LIMIT 1;
ERROR 2013 (HY000): Lost connection to MySQL server during query

(gdb) bt
#0  RemoveRange (this=<optimized out>, hi=0x7f085a875fff, low=0x7f085a875000) at /stonedb/storage/tianmu/mm/tcm_heap_policy.h:79
#1  Tianmu::mm::TCMHeap::dealloc(void*) () at /stonedb/storage/tianmu/mm/tcm_heap_policy.cpp:121
#2  0x0000000001673fea in Tianmu::mm::MemoryHandling::dealloc(void*, Tianmu::mm::TraceableObject*) () at /stonedb/storage/tianmu/mm/memory_handling_policy.cpp:314
#3  0x000000000167e11b in dealloc (ptr=0x7f085a875000, this=0x7f0790511230) at /stonedb/storage/tianmu/mm/traceable_object.h:112
#4  Tianmu::mm::TraceableObject::dealloc(void*) () at /stonedb/storage/tianmu/mm/traceable_object.cpp:67
#5  0x00000000018226fa in Tianmu::core::CachedBuffer<Tianmu::types::BString>::~CachedBuffer (this=0x7f0790511190, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/cached_buffer.cpp:57
#6  0x0000000001614711 in ~AttrBuffer (this=0x7f0790511190, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/temp_table.cpp:50
#7  ~AttrBuffer (this=0x7f0790511190, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/temp_table.cpp:50
#8  Tianmu::core::TempTable::Attr::DeleteBuffer (this=this@entry=0x7f0790773b00) at /stonedb/storage/tianmu/core/temp_table.cpp:255
#9  0x0000000001614a3f in Tianmu::core::TempTable::Attr::~Attr (this=0x7f0790773b00, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/temp_table.cpp:114
#10 0x0000000001614ac2 in Tianmu::core::TempTable::Attr::~Attr (this=0x7f0790773b00, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/temp_table.cpp:113
#11 0x000000000161f0be in Tianmu::core::TempTable::~TempTable (this=0x7f0790620a30, __in_chrg=<optimized out>) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/stl_vector.h:1040
#12 0x000000000161f332 in Tianmu::core::TempTable::~TempTable (this=0x7f0790620a30, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/temp_table.cpp:970
#13 0x00000000015f8ad5 in _M_release (this=0x7f07902499f0) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/shared_ptr_base.h:148
#14 _M_release (this=0x7f07902499f0) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/shared_ptr_base.h:148
#15 ~__shared_count (this=<optimized out>, __in_chrg=<optimized out>) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/shared_ptr_base.h:730
#16 ~__shared_ptr (this=0x7f07901bcf60, __in_chrg=<optimized out>) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/shared_ptr_base.h:1169
#17 ~shared_ptr (this=0x7f07901bcf60, __in_chrg=<optimized out>) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/shared_ptr.h:103
#18 _Destroy<std::shared_ptr<Tianmu::core::JustATable> > (__pointer=0x7f07901bcf60) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/stl_construct.h:98
#19 __destroy<std::shared_ptr<Tianmu::core::JustATable>*> (__last=<optimized out>, __first=0x7f07901bcf60) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/stl_construct.h:108
#20 _Destroy<std::shared_ptr<Tianmu::core::JustATable>*> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/stl_construct.h:137
#21 _Destroy<std::shared_ptr<Tianmu::core::JustATable>*, std::shared_ptr<Tianmu::core::JustATable> > (__last=0x7f07901bcf70, __first=<optimized out>)
    at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/stl_construct.h:206
#22 ~vector (this=0x7f0cfd8d8e88, __in_chrg=<optimized out>) at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/stl_vector.h:677
#23 Tianmu::core::Query::~Query (this=0x7f0cfd8d8cd0, __in_chrg=<optimized out>) at /stonedb/storage/tianmu/core/query.cpp:42
#24 0x00000000009818ed in Tianmu::core::Engine::Execute (this=0x549ea60, thd=0x7f0790000ae0, lex=0x7f0790002c60, result_output=0x7f07903f2970, unit_for_union=0x0)
    at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/unique_ptr.h:286
#25 0x00000000015f0e1a in Tianmu::core::Engine::HandleSelect(THD*, LEX*, Query_result*&, unsigned long, int&, int&, int&, int) () at /stonedb/storage/tianmu/core/engine_execute.cpp:233
#26 0x00000000017f8fb1 in Tianmu::DBHandler::ha_my_tianmu_query(THD*, LEX*, Query_result*&, unsigned long, int&, int&, int&, int) () at /stonedb/storage/tianmu/sql/ha_my_tianmu.cpp:93
#27 0x0000000000fc81b8 in execute_sqlcom_select (thd=thd@entry=0x7f0790000ae0, all_tables=<optimized out>) at /stonedb/sql/sql_parse.cc:5203
#28 0x0000000000fcf7d3 in mysql_execute_command(THD*, bool) () at /stonedb/sql/sql_parse.cc:2847
#29 0x0000000000fd19f5 in mysql_parse (thd=thd@entry=0x7f0790000ae0, parser_state=parser_state@entry=0x7f0cfd8d9fa0) at /stonedb/sql/sql_parse.cc:5642
#30 0x0000000000fd2ff9 in dispatch_command(THD*, COM_DATA const*, enum_server_command) () at /stonedb/sql/sql_parse.cc:1495
#31 0x0000000000fd3d17 in do_command (thd=thd@entry=0x7f0790000ae0) at /stonedb/sql/sql_parse.cc:1034
#32 0x000000000108c708 in handle_connection (arg=arg@entry=0x7e61800) at /stonedb/sql/conn_handler/connection_handler_per_thread.cc:313
#33 0x0000000001563c54 in pfs_spawn_thread (arg=0x7e1b790) at /stonedb/storage/perfschema/pfs.cc:2197

Expected behavior

No response

How To Reproduce

No response

Environment

No response

Are you interested in submitting a PR to solve the problem?