Skip to content

bug: bool JOIN::init_planner_arrays(): Assertion `primary_tables == 0 && tables == 0' failed. #1276

@isredstar

Description

@isredstar

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

When the server is debug compiled, the server will crash In some cases.

mysql> SELECT
    -> bb.first_name,
    -> bb.last_name 
    -> FROM
    -> (
    -> SELECT
    -> count( distinct a.first_name ) AS first_name,
    -> a.last_name AS last_name 
    -> FROM
    -> t_test a,
    -> t_test b 
    -> WHERE
    -> a.id = b.id 
    -> GROUP BY
    -> a.last_name
    -> ) bb;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

LOG INFORMATION:

mysqld: /data/src/ce/stonedb/sql/sql_optimizer.cc:5286: bool JOIN::init_planner_arrays(): Assertion `primary_tables == 0 && tables == 0' failed.
02:31:50 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=536870912
read_buffer_size=4194304
max_used_connections=1
max_threads=100
thread_count=1
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1344870 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7fe7f4000e10
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7fed1279ff18 thread_stack 0x80000
/stonedb57/install/bin/mysqld(my_print_stacktrace+0x4b)[0x55a9390d5f14]
/stonedb57/install/bin/mysqld(handle_fatal_signal+0x3f7)[0x55a9385c26d8]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7fed19379420]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fed1906500b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fed19044859]
/lib/x86_64-linux-gnu/libc.so.6(+0x22729)[0x7fed19044729]
/lib/x86_64-linux-gnu/libc.so.6(+0x33fd6)[0x7fed19055fd6]
/stonedb57/install/bin/mysqld(_ZN4JOIN19init_planner_arraysEv+0x65)[0x55a938d3eb79]
/stonedb57/install/bin/mysqld(_ZN4JOIN14make_join_planEv+0x74)[0x55a938d3e300]
/stonedb57/install/bin/mysqld(_ZN4JOIN8optimizeEh+0x1024)[0x55a938d32092]
/stonedb57/install/bin/mysqld(_ZN18st_select_lex_unit21optimize_after_tianmuEv+0x11f)[0x55a9396c75c3]
/stonedb57/install/bin/mysqld(_ZN6Tianmu4core6Engine12HandleSelectEP3THDP3LEXRP12Query_resultmRiS9_S9_i+0xd04)[0x55a9396c4b1a]
/stonedb57/install/bin/mysqld(_ZN6Tianmu7handler18ha_my_tianmu_queryEP3THDP3LEXRP12Query_resultmRiS8_S8_i+0x60)[0x55a9397de55e]
/stonedb57/install/bin/mysqld(+0x24388d4)[0x55a938d618d4]
/stonedb57/install/bin/mysqld(_Z21mysql_execute_commandP3THDb+0xefa)[0x55a938d5a943]
/stonedb57/install/bin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x648)[0x55a938d62962]
/stonedb57/install/bin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0xc48)[0x55a938d574f3]
/stonedb57/install/bin/mysqld(_Z10do_commandP3THD+0x522)[0x55a938d5636a]
/stonedb57/install/bin/mysqld(handle_connection+0x1f0)[0x55a938e9ef2c]
/stonedb57/install/bin/mysqld(pfs_spawn_thread+0x174)[0x55a9395eae59]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8609)[0x7fed1936d609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7fed19141133]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fe7f4005b40): is an invalid pointer
Connection ID (thread ID): 2
Status: NOT_KILLED

Expected behavior

No response

How To Reproduce

 CREATE TABLE `t_test` (
  `id` int(11) NOT NULL,
  `first_name` varchar(10) NOT NULL,
  `last_name` varchar(10) NOT NULL,
  `sex` varchar(5) NOT NULL,
  `score` int(11) NOT NULL,
  `copy_id` int(11) NOT NULL
) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4
SELECT
	bb.first_name,
	bb.last_name 
FROM
	(
SELECT
	count( distinct a.first_name ) AS first_name,
	a.last_name AS last_name 
FROM
	t_test a,
	t_test b 
WHERE
	a.id = b.id 
GROUP BY
	a.last_name
	) bb;

Environment

No response

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

  • Yes, I will!

Metadata

Metadata

Assignees

Labels

A-bugSomething isn't workingB-SQLSQL layerC-stonedb-5.7associated with stonedb 5.7prio: highHigh priority

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions