Bug #98061 crash when apply relaylog with virtual generated column

Submitted: 24 Dec 2019 4:17 Modified: 24 Dec 2019 9:22
Reporter: Jia Xu Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:5.7 OS:Linux
Assigned to: CPU Architecture:Any

[24 Dec 2019 4:17] Jia Xu
Description:
TXSQL Team from Tencent 

One mysql instance persistently crash, following is the corefile stack

The table caused the crash is like 
```
create table test(
`createdAt` datetime NOT NULL,
`beginTime` varchar(45) GENERATED ALWAYS AS (cast(concat(substr(`createdAt`,1,8),'01 00:00:01') as datetime)) VIRTUAL
)
```

In the stack, the 4# Item is cast function, 3# Item is concat function

#0  0x00007fceea795741 in pthread_kill () from /lib64/libpthread.so.0
#1  0x000000000079efc5 in handle_fatal_signal (sig=11) at /data/txsql-work/5.7/txsql/sql/signal_handler.cc:220
#2  <signal handler called>
#3  0x000000000084d443 in Item_func::walk (this=0x7fce88021828, processor=&virtual table offset 736, walk=Item::WALK_POSTFIX, argument=0x7fce880053a0 "") at /data/txsql-work/5.7/txsql/sql/item_func.cc:325
#4  0x000000000084d449 in Item_func::walk (this=0x7fce88021750, processor=&virtual table offset 736, walk=Item::WALK_POSTFIX, argument=0x7fce880053a0 "") at /data/txsql-work/5.7/txsql/sql/item_func.cc:325
#5  0x0000000000d169d9 in fix_fields_gcol_func (thd=thd@entry=0x7fce880008c0, field=field@entry=0x7fce88014df0) at /data/txsql-work/5.7/txsql/sql/table.cc:2771
#6  0x0000000000d1eeb4 in TABLE::refix_gc_items (this=this@entry=0x7fce88012e30, thd=thd@entry=0x7fce880008c0) at /data/txsql-work/5.7/txsql/sql/table.cc:4736
#7  0x0000000000d20df1 in TABLE::init (this=this@entry=0x7fce88012e30, thd=thd@entry=0x7fce880008c0, tl=tl@entry=0x7fce88038130) at /data/txsql-work/5.7/txsql/sql/table.cc:4690
#8  0x0000000000c2a348 in open_table (thd=thd@entry=0x7fce880008c0, table_list=table_list@entry=0x7fce88038130, ot_ctx=ot_ctx@entry=0x7fcebd28e5d0) at /data/txsql-work/5.7/txsql/sql/sql_base.cc:3611
#9  0x0000000000c318d2 in open_and_process_table (flags=0, ot_ctx=0x7fcebd28e5d0, has_prelocking_list=false, prelocking_strategy=0x7fcebd28e6e0, counter=0x7fcebd28e660, tables=0x7fce88038130, lex=<optimized out>, thd=0x7fce880008c0)
    at /data/txsql-work/5.7/txsql/sql/sql_base.cc:5122
#10 open_tables (thd=thd@entry=0x7fce880008c0, start=start@entry=0x7fcebd28e658, counter=counter@entry=0x7fcebd28e660, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x7fcebd28e6e0)
    at /data/txsql-work/5.7/txsql/sql/sql_base.cc:5739
#11 0x0000000000c320d5 in open_and_lock_tables (thd=0x7fce880008c0, tables=0x7fce88038130, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x7fcebd28e6e0) at /data/txsql-work/5.7/txsql/sql/sql_base.cc:6459
#12 0x0000000000e26707 in open_and_lock_tables (flags=0, tables=<optimized out>, thd=<optimized out>) at /data/txsql-work/5.7/txsql/sql/sql_base.h:477
#13 Rows_log_event::do_apply_event (this=0x7fce8808b500, rli=0x4590180) at /data/txsql-work/5.7/txsql/sql/log_event.cc:10773
#14 0x0000000000e1f5d2 in Log_event::apply_event (this=this@entry=0x7fce8808b500, rli=rli@entry=0x4590180) at /data/txsql-work/5.7/txsql/sql/log_event.cc:3328
#15 0x0000000000e623b0 in apply_event_and_update_pos (ptr_ev=ptr_ev@entry=0x7fcebd28e9f0, thd=thd@entry=0x7fce880008c0, rli=rli@entry=0x4590180) at /data/txsql-work/5.7/txsql/sql/rpl_slave.cc:4715
#16 0x0000000000e6f1b2 in exec_relay_log_event (rli=0x4590180, thd=<optimized out>) at /data/txsql-work/5.7/txsql/sql/rpl_slave.cc:5231
#17 handle_slave_sql (arg=arg@entry=0x44ee230) at /data/txsql-work/5.7/txsql/sql/rpl_slave.cc:7402
#18 0x00000000012145d1 in pfs_spawn_thread (arg=0x4554980) at /data/txsql-work/5.7/txsql/storage/perfschema/pfs.cc:2188
#19 0x00007fceea790dc5 in start_thread () from /lib64/libpthread.so.0
#20 0x00007fcee966f74d in clone () from /lib64/libc.so.6

I can't repeat the crash, the relay log event that caused crash will be applied successfully after recovery.
But after a few minutes, It crashed again.

The event caused crash may be a update row event

How to repeat:
I can't repeat this bug.
[24 Dec 2019 8:11] MySQL Verification Team
Thank you for the bug report. We need a repeatable test case when you will be able to provide it, please add it here. Thanks.
[24 Dec 2019 9:22] Jia Xu
I can't repeat the bug now, but I have a corefile.
Is corefile can help finding the problem?
[24 Dec 2019 10:06] MySQL Verification Team
A core file isn't enough for further fix process.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.