InnoDB: Assertion failure in thread 139846953457408 in file row0sel.cc line 3183
Description
Environment
Attachments
Smart Checklist
Activity

Lalit Choudhary December 14, 2018 at 1:02 PMEdited
Hi
Thank you for the update.
I'm not able to reproduce described behavior with given table structure and configuration in my environment.
please share the output of below.
NOTE: Replace original data with dummy while sending output for this query.
My Test: [ Server version: 5.7.23-25-log Percona Server ]
1.create given table.
2. loaded data from store procedure[ test attached]
Since you are able to reproduce this issue in your environment, please upload core dump on our JIRA SFTP server.
To take core dump do following,
#my.cnf
To access sftp use the issue ID as username and password (i.e ) example:

Howtin Gong December 14, 2018 at 9:57 AM
P.S. The MySQL server runs on Amazon Linux AMI `Linux 4.14.33-51.37.amzn1.x86_64 #1 SMP Thu May 3 20:07:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux`

Howtin Gong December 14, 2018 at 9:53 AM
Hi Lalit,
Thanks for checking this issue. I've uploaded the .log file and .cnf file.
Finally, we found this crash could be reproduced with any SQL which returns data from a special id `6116689` from the table, like `select * from ugc_story where id = 6116689`
Indeed, we have a table named `ugc_story`, here is the table structure:
```
create TABLE ugc_story(
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
meta JSON NOT NULL,
dialogs JSON NOT NULL,
dver int GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(meta, '$.dver'))) VIRTUAL,
collection_id int GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(meta, '$.collection_id'))) VIRTUAL,
author_id BIGINT GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(meta, '$.author_id'))) VIRTUAL,
status tinyint GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(meta, '$.status'))) VIRTUAL,
update_time bigint(20) GENERATED ALWAYS AS (json_unquote(json_extract(meta,'$.update_time'))) VIRTUAL,
PRIMARY KEY(id),
KEY idx_collection_status(collection_id, status),
KEY idx_author(author_id),
KEY idx_status_update_time (status, update_time)
)ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 default charset utf8mb4;
```
The `dialogs` field contains JSON structure with any text from user input. We finally found the special id `6116689`, if we do any query with any returns data from the id, the database would crash. So we could not get any data from this id to find out more.
Because we server millions of people, so we just filtered the id from any query to prevent this crash again to keep our servers running.

Lalit Choudhary December 14, 2018 at 9:21 AM
Hi
Please share the following information.
Full error log (when a crash occurred)
my.cnf file and OS info
Operation/activity you were performing when the crash occurred
If you have reproducible test case please provide that.
>We just upgrade to 5.7.23 yesterday, but the problem is still there.
Also, share the step you performed for an upgrade from 5.7.22 to 5.7.23
The latest release of Percona server 5.7.24-26 available, you can test this with this latest version.
corrWe are running 5.7.22 for months, but recent two days the below crash has happened 3 times already, the mysqld process crashed totally. We just upgrade to 5.7.23 yesterday, but the problem is still there.
Here is the full log:
2018-11-11 10:53:27 0x7f30a7fbd700 InnoDB: Assertion failure in thread 139846953457408 in file row0sel.cc line 3183
InnoDB: Failing assertion: (!prebuilt->idx_cond && prebuilt->m_mysql_handler->end_range != NULL) || (prebuilt->trx->isolation_level == TRX_ISO_READ_UNCOMMITTED)
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
02:53:27 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.
Please help us make Percona Server better by reporting any
bugs at http://bugs.percona.com/
key_buffer_size=2097152
read_buffer_size=2097152
max_used_connections=4894
max_threads=25601
thread_count=4893
connection_count=4893
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 105221862 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x7f32700db760
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 = 7f30a7fbcd80 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x2c)[0xec60ec]
/usr/sbin/mysqld(handle_fatal_signal+0x461)[0x79e811]
/lib64/libpthread.so.0(+0xf690)[0x7f4b3d90f690]
/lib64/libc.so.6(gsignal+0x37)[0x7f4b3ba1b277]
/lib64/libc.so.6(abort+0x148)[0x7f4b3ba1c968]
/usr/sbin/mysqld[0x76c292]
/usr/sbin/mysqld[0x107ff3e]
/usr/sbin/mysqld(_Z15row_search_mvccPh15page_cur_mode_tP14row_prebuilt_tmm+0x2d6f)[0x1083cdf]
/usr/sbin/mysqld(_ZN11ha_innobase13general_fetchEPhjj+0x1b8)[0xf6eb08]
/usr/sbin/mysqld(_ZN7handler13ha_index_nextEPh+0xdc)[0x8012bc]
/usr/sbin/mysqld(_ZN7handler15read_range_nextEv+0x20)[0x8057e0]
/usr/sbin/mysqld(_ZN7handler21multi_range_read_nextEPPc+0xd2)[0x7fae02]
/usr/sbin/mysqld(_ZN18QUICK_RANGE_SELECT8get_nextEv+0x4b)[0xdc9c2b]
/usr/sbin/mysqld[0xc0356a]
/usr/sbin/mysqld(_Z10sub_selectP4JOINP7QEP_TABb+0x147)[0xc73a97]
/usr/sbin/mysqld(_ZN4JOIN4execEv+0x237)[0xc6c977]
/usr/sbin/mysqld(_Z12handle_queryP3THDP3LEXP12Query_resultyy+0x17d)[0xcdc49d]
/usr/sbin/mysqld[0x75c543]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THDb+0x4816)[0xc9f396]
/usr/sbin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x5ad)[0xca258d]
/usr/sbin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0xabd)[0xca314d]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x1b7)[0xca4b27]
/usr/sbin/mysqld(handle_connection+0x2a0)[0xd6a430]
/usr/sbin/mysqld(pfs_spawn_thread+0x1b4)[0xeddd84]
/lib64/libpthread.so.0(+0x7de5)[0x7f4b3d907de5]
/lib64/libc.so.6(clone+0x6d)[0x7f4b3bae3bad]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f3270035dc0): is an invalid pointer
Connection ID (thread ID): 312271
Status: NOT_KILLED
You may download the Percona Server operations manual by visiting
http://www.percona.com/software/percona-server/. You may find information
in the manual which will help you identify the cause of the crash.