Bug #94796 Stack overflow in call open_dict_table function
Submitted: 27 Mar 2019 8:02 Modified: 2 May 2019 13:22
Reporter: dave do Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[27 Mar 2019 8:02] dave do
Description:
when the function call to open_dict_table, it will fall into a recursive call like below:

#6354 0x000000000497286f in dict_table_get_low (table_name=0x5dfccb2 "SYS_TABLES") at /sql/storage/innobase/include/dict0priv.ic:61
#6355 0x0000000004978e6f in dict_load_table_one (name=..., cached=true, ignore_err=DICT_ERR_IGNORE_NONE, fk_tables=std::deque with 0 elements)
    at /sql/storage/innobase/dict/dict0load.cc:2306
#6356 0x0000000004978557 in dict_load_table (name=0x5dfccb2 "SYS_TABLES", cached=true, ignore_err=DICT_ERR_IGNORE_NONE)
    at /sql/storage/innobase/dict/dict0load.cc:2129

#6357 0x000000000497286f in dict_table_get_low (table_name=0x5dfccb2 "SYS_TABLES") at /sql/storage/innobase/include/dict0priv.ic:61

#6358 0x0000000004978e6f in dict_load_table_one (name=..., cached=true, ignore_err=DICT_ERR_IGNORE_NONE, fk_tables=std::deque with 0 elements)
    at /sql/storage/innobase/dict/dict0load.cc:2306
#6359 0x0000000004978557 in dict_load_table (name=0x7ffec3ffd520 "test/view_table_update_060", cached=true, ignore_err=DICT_ERR_IGNORE_NONE)
    at /sql/storage/innobase/dict/dict0load.cc:2129

#6360 0x0000000004933dbe in dict_table_open_on_name (table_name=0x7ffec3ffd520 "test/view_table_update_060", dict_locked=0, try_drop=1, ignore_err=DICT_ERR_IGNORE_NONE)
    at /sql/storage/innobase/dict/dict0dict.cc:1100
#6361 0x00000000045b6db6 in ha_innobase::open_dict_table (table_name=0x7ffec3ffdab0 "./test/view_table_update_060", norm_name=0x7ffec3ffd520 "test/view_table_update_060",
    is_partition=false, ignore_err=DICT_ERR_IGNORE_NONE) at /sql/storage/innobase/handler/ha_innodb.cc:7035

the main reason is sys_tables = dict_table_get_low("SYS_TABLES"); in the function dict_load_table_one will cause a recursive call.

How to repeat:
1. Try to open a table not in the dict table cache.
2. The stack info I given in the description is based on MySQL 8.0.13, and I found there is no caller of ha_innobase::open_dict_table now. but in 5.7 or earlier release , the issue is still existed.

Suggested fix:
we need break the recursive call chain while we find we have falling into that.
[27 Mar 2019 13:49] zhai weixiang
In MySQL 8.0, you may need to invoke functions with dd_ (for example: dd_table_open_on_id/dd_table_open_on_name) if you want to get  something from dictionary cache.   :)
[27 Mar 2019 13:50] MySQL Verification Team
Hi,

Thank you for your bug report.

I was not able to repeat this problem with 5.7.25. 

I have started server, with low values for the table definition cache and table cache and opened a table that is not in the dictionary cache. It worked just fine.

Hence, what we need from you is a fully repeatable test case, that will show the error anytime when we run the test case.

Thanks in advance.
[28 Apr 2019 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".