[MDEV-8615] Assertion `m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_start Created: 2015-08-13  Updated: 2016-02-18  Resolved: 2016-02-18

Status: Closed
Project: MariaDB Server
Component/s: Parser
Affects Version/s: 10.1
Fix Version/s: 10.1.11

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6958 10.1 testing Closed
Sprint: 10.1.10, 10.1.11, 10.1.12

 Description   

--disable_abort_on_error
--query SELECT '
--query b'

Stack trace from 10.1 9d884fd3d3fadd5ad31ecfee915877b98258e546

10.1/sql/sql_lex.cc:326: void Lex_input_stream::body_utf8_start(THD*, const char*): Assertion `m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length' failed.
150813 18:36:21 [ERROR] mysqld got signal 6 ;
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f30c715a088): b'
Connection ID (thread ID): 3
Status: NOT_KILLED

#6  0x00007f30cdd26311 in *__GI___assert_fail (assertion=0x7f30d0fb9960 "m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length", file=<optimized out>, line=326, function=0x7f30d0fbb5c0 "void Lex_input_stream::body_utf8_start(THD*, const char*)") at assert.c:81
#7  0x00007f30d067e293 in Lex_input_stream::body_utf8_start (this=0x7f30c676b1a8, thd=0x7f30c7209070, begin_ptr=0x7f30c715a0f3 "\245\245\245\245\245 `\230\321\060\177") at 10.1/sql/sql_lex.cc:326
#8  0x00007f30d09f35d7 in sp_head::set_body_start (this=0x7f30c93d1088, thd=0x7f30c7209070, begin_ptr=0x7f30c715a0f3 "\245\245\245\245\245 `\230\321\060\177") at 10.1/sql/sp_head.cc:719
#9  0x00007f30d08604d6 in maybe_start_compound_statement (thd=0x7f30c7209070) at 10.1/sql/sql_yacc.yy:264
#10 0x00007f30d0866dfa in MYSQLparse (thd=0x7f30c7209070) at 10.1/sql/sql_yacc.yy:3771
#11 0x00007f30d06a3973 in parse_sql (thd=0x7f30c7209070, parser_state=0x7f30c676b1a0, creation_ctx=0x0, do_pfs_digest=true) at 10.1/sql/sql_parse.cc:9167
#12 0x00007f30d069f883 in mysql_parse (thd=0x7f30c7209070, rawbuf=0x7f30c715a088 "b'", length=2, parser_state=0x7f30c676b1a0) at 10.1/sql/sql_parse.cc:7156
#13 0x00007f30d068e8cd in dispatch_command (command=COM_QUERY, thd=0x7f30c7209070, packet=0x7f30cb3f9071 "b'", packet_length=2) at 10.1/sql/sql_parse.cc:1475
#14 0x00007f30d068d5f3 in do_command (thd=0x7f30c7209070) at 10.1/sql/sql_parse.cc:1097
#15 0x00007f30d07cf229 in do_handle_one_connection (thd_arg=0x7f30c7209070) at 10.1/sql/sql_connect.cc:1350
#16 0x00007f30d07cef7a in handle_one_connection (arg=0x7f30c7209070) at 10.1/sql/sql_connect.cc:1262
#17 0x00007f30d0d4fe8b in pfs_spawn_thread (arg=0x7f30cd423af0) at 10.1/storage/perfschema/pfs.cc:1860
#18 0x00007f30cfd41b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#19 0x00007f30cddd695d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#20 0x0000000000000000 in ?? ()



 Comments   
Comment by Oleksandr Byelkin [ 2015-12-17 ]

in 10.0 the assert is present but there is no problem observed...

Comment by Oleksandr Byelkin [ 2015-12-17 ]

in 10.0 it just not call Lex_input_stream::body_utf8_start in this statement.

Comment by Oleksandr Byelkin [ 2015-12-21 ]

query -> verb_clause END_OF_INPUT -> compound_statement -> sp_proc_stmt_compound_ok -> sp_unlabeled_control --->
 
#4  0x0000555555a0c971 in Lex_input_stream::body_utf8_start (this=0x7ffff0d33238, thd=0x5555578a0670, begin_ptr=0x7fffdc013a93 "\245\245\245\245\245") at /home/sanja/maria/git/server/sql/sql_lex.cc:325
#5  0x0000555555d9f4f3 in sp_head::set_body_start (this=0x7fffdc0db2b8, thd=0x5555578a0670, begin_ptr=0x7fffdc013a93 "\245\245\245\245\245") at /home/sanja/maria/git/server/sql/sp_head.cc:719
#6  0x0000555555be0625 in maybe_start_compound_statement (thd=0x5555578a0670) at /home/sanja/maria/git/server/sql/sql_yacc.yy:246
#7  0x0000555555be7044 in MYSQLparse (thd=0x5555578a0670) at /home/sanja/maria/git/server/sql/sql_yacc.yy:3773
#8  0x0000555555a325c2 in parse_sql (thd=0x5555578a0670, parser_state=0x7ffff0d33230, creation_ctx=0x0, do_pfs_digest=true) at /home/sanja/maria/git/server/sql/sql_parse.cc:9267
#9  0x0000555555a2e434 in mysql_parse (thd=0x5555578a0670, rawbuf=0x7fffdc013a28 "b'", length=2, parser_state=0x7ffff0d33230) at /home/sanja/maria/git/server/sql/sql_parse.cc:7253
#10 0x0000555555a1cfcb in dispatch_command (command=COM_QUERY, thd=0x5555578a0670, packet=0x5555578a7061 "b'", packet_length=2) at /home/sanja/maria/git/server/sql/sql_parse.cc:1487

Comment by Oleksandr Byelkin [ 2015-12-21 ]

So the problem added by compound statements (probably)

Comment by Oleksandr Byelkin [ 2015-12-21 ]

Yes, the problem is sp_unlabeled_control which start doing somethoing without be sure that even one keyword fit to what we parse.

Comment by Oleksandr Byelkin [ 2015-12-21 ]

revision-id: daad4828b078485ee7ac60af4fc165ae35684395 (mariadb-10.1.9-21-gdaad482)
parent(s): 59fcd7ff2315d007045eb987da5f21abbea6f6f1
committer: Oleksandr Byelkin
timestamp: 2015-12-21 20:13:12 +0100
message:

MDEV-8615: Assertion `m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_start

If it is EOF then it may not be start of compound statement.

Comment by Oleksandr Byelkin [ 2015-12-25 ]

(I am not sure that this fix is better)

revision-id: 684bd68c33284f6106551188d9567f35b18593ed (mariadb-10.1.9-21-g684bd68)
parent(s): 59fcd7ff2315d007045eb987da5f21abbea6f6f1
committer: Oleksandr Byelkin
timestamp: 2015-12-25 18:39:43 +0100
message:

MDEV-8615: Assertion `m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_start

Nothing should be done before any keyword recognised.

Comment by Oleksandr Byelkin [ 2016-01-27 ]

revision-id: 57bf58668877552ee43f4ed86689b8bbb3821c9c (mariadb-10.1.10-23-g57bf586)
parent(s): 825f51d1aab51d363dc07ec9fe0829af33063883
committer: Oleksandr Byelkin
timestamp: 2016-01-27 00:38:36 +0100
message:

MDEV-8615: Assertion `m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_start

Nothing should be done before any keyword recognized.

Comment by Sergei Golubchik [ 2016-02-18 ]

ok to push!

Generated at Thu Feb 08 07:28:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.