[MDEV-9920] SEGFAULT in get_column_grant() Created: 2016-04-14  Updated: 2016-04-21  Resolved: 2016-04-21

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System
Affects Version/s: 10.1.13, 10.0, 10.1, 10.2
Fix Version/s: 10.0.25

Type: Bug Priority: Critical
Reporter: Igor Pashev Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: contribution, patch

Attachments: File my.cnf    
Sprint: 10.0.25

 Description   

We get [ERROR] mysqld got signal 11 quite often. And stack trace looks the same each time. There might be a lot of GRANT... statements running at the same time.

Apr 13 14:26:58 petcat mysqld[32002]: Server version: 10.1.13-MariaDB
Apr 13 14:26:58 petcat mysqld[32002]: key_buffer_size=134217728
Apr 13 14:26:58 petcat mysqld[32002]: read_buffer_size=131072
Apr 13 14:26:58 petcat mysqld[32002]: max_used_connections=59
Apr 13 14:26:58 petcat mysqld[32002]: max_threads=1002
Apr 13 14:26:58 petcat mysqld[32002]: thread_count=33
Apr 13 14:26:58 petcat mysqld[32002]: It is possible that mysqld could use up to
Apr 13 14:26:58 petcat mysqld[32002]: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 4384024 K  bytes of memory
Apr 13 14:26:58 petcat mysqld[32002]: Hope that's ok; if not, decrease some variables in the equation.
Apr 13 14:26:58 petcat mysqld[32002]: Thread pointer: 0x0x7f0e6736c008
Apr 13 14:26:58 petcat mysqld[32002]: Attempting backtrace. You can use the following information to find out
Apr 13 14:26:58 petcat mysqld[32002]: where mysqld died. If you see no messages after this, something went
Apr 13 14:26:58 petcat mysqld[32002]: terribly wrong...
Apr 13 14:26:58 petcat mysqld[32002]: stack_bottom = 0x7f0e009f8218 thread_stack 0x48400
Apr 13 14:26:59 petcat mysqld[32002]: (my_addr_resolve failure: fork)
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(my_print_stacktrace+0x29) [0x7f1949d56179]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_fatal_signal+0x355) [0x7f19498b5465]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x103e0) [0x7f1948edd3e0]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_column_grant(THD*, st_grant_info*, char const*, char const*, char const*)+0x
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x4940e4) [0x7f19497a10e4]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x48a9db) [0x7f19497979db]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_all_tables(THD*, TABLE_LIST*, Item*)+0x1c7) [0x7f19497a94c7]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_schema_tables_result(JOIN*, enum_schema_table_state)+0x287) [0x7f19497ab167]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec_inner()+0x590) [0x7f1949792310]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec()+0x44) [0x7f19497944b4]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsig
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_select(THD*, LEX*, select_result*, unsigned long)+0x130) [0x7f19497919b0]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x426a18) [0x7f1949733a18]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_execute_command(THD*)+0x6170) [0x7f194973f830]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x274) [0x7f1949742a54]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1bb6) [0x7f19
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_command(THD*)+0x16b) [0x7f1949745afb]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_handle_one_connection(THD*)+0x18c) [0x7f1949806b0c]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_one_connection+0x37) [0x7f1949806ce7]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x8484) [0x7f1948ed5484]
Apr 13 14:26:59 petcat mysqld[32002]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libc.so.6(clone+0x6d) [0x7f194685ff3d]
 
...
Apr 14 15:52:59 petcat mysqld[1554]: (my_addr_resolve failure: fork)
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(my_print_stacktrace+0x29) [0x7f482fca0179]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_fatal_signal+0x355) [0x7f482f7ff465]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x103e0) [0x7f482ee273e0]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_column_grant(THD*, st_grant_info*, char const*, char const*, char const*)+0x1
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x4940e4) [0x7f482f6eb0e4]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x48a9db) [0x7f482f6e19db]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_all_tables(THD*, TABLE_LIST*, Item*)+0x1c7) [0x7f482f6f34c7]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_schema_tables_result(JOIN*, enum_schema_table_state)+0x287) [0x7f482f6f5167]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec_inner()+0x590) [0x7f482f6dc310]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec()+0x44) [0x7f482f6de4b4]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsign
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_select(THD*, LEX*, select_result*, unsigned long)+0x130) [0x7f482f6db9b0]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x426a18) [0x7f482f67da18]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_execute_command(THD*)+0x6170) [0x7f482f689830]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x274) [0x7f482f68ca54]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1bb6) [0x7f482
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_command(THD*)+0x16b) [0x7f482f68fafb]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_handle_one_connection(THD*)+0x18c) [0x7f482f750b0c]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_one_connection+0x37) [0x7f482f750ce7]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x8484) [0x7f482ee1f484]
Apr 14 15:52:59 petcat mysqld[1554]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libc.so.6(clone+0x6d) [0x7f482c7a9f3d]



 Comments   
Comment by Igor Pashev [ 2016-04-15 ]

It might be caused by requests like SHOW COLUMNS FROM ...:

Apr 15 14:59:39 petcat mysqld[22833]: (my_addr_resolve failure: fork)
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(my_print_stacktrace+0x29) [0x7f89b65e2179]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_fatal_signal+0x355) [0x7f89b6141465]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x103e0) [0x7f89b57693e0]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_column_grant(THD*, st_grant_info*, char const*, char const*, char const*)+0x
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x4940e4) [0x7f89b602d0e4]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x48a9db) [0x7f89b60239db]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_all_tables(THD*, TABLE_LIST*, Item*)+0x1c7) [0x7f89b60354c7]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_schema_tables_result(JOIN*, enum_schema_table_state)+0x287) [0x7f89b6037167]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec_inner()+0x590) [0x7f89b601e310]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec()+0x44) [0x7f89b60204b4]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsig
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_select(THD*, LEX*, select_result*, unsigned long)+0x130) [0x7f89b601d9b0]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x426a18) [0x7f89b5fbfa18]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_execute_command(THD*)+0x6170) [0x7f89b5fcb830]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x274) [0x7f89b5fcea54]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1bb6) [0x7f89
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_command(THD*)+0x16b) [0x7f89b5fd1afb]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_handle_one_connection(THD*)+0x18c) [0x7f89b6092b0c]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_one_connection+0x37) [0x7f89b6092ce7]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x8484) [0x7f89b5761484]
Apr 15 14:59:39 petcat mysqld[22833]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libc.so.6(clone+0x6d) [0x7f89b30ebf3d]
Apr 15 14:59:39 petcat mysqld[22833]: Trying to get some variables.
Apr 15 14:59:39 petcat mysqld[22833]: Some pointers may be invalid and cause the dump to abort.
Apr 15 14:59:39 petcat mysqld[22833]: Query (0x7f7eca21c020): SHOW COLUMNS FROM `snap_2016_01_bob_live_tw`.`customer`
Apr 15 14:59:39 petcat mysqld[22833]: Connection ID (thread ID): 399
Apr 15 14:59:39 petcat mysqld[22833]: Status: NOT_KILLED

Comment by Elena Stepanova [ 2016-04-16 ]

Is the crash reproducible by just running the same statement from MySQL client?

Comment by Igor Pashev [ 2016-04-16 ]

Yes. Some more info: a user connects through SSL, a user is granted a role only, the role is granted other roles. Some more tests:

# mysql --defaults-file=.petcat -e "SET ROLE all_all; SHOW COLUMNS FROM bob_live_tw.customer_address;"
ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query
# mysql --defaults-file=.petcat -e "SET ROLE all_all; SHOW COLUMNS FROM bob_live_tw.sales_order;"
ERROR 1142 (42000) at line 1: SELECT command denied to user 'igor.pashev@zalora.com'@'xxx' for table 'sales_order'
# mysql --defaults-file=.petcat -e "SET ROLE all_all; SHOW COLUMNS FROM bob_live_id.sales_order;"
ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query
# mysql --defaults-file=.petcat -e "SET ROLE all_all; SHOW COLUMNS FROM bob_live_id.sales_order_item;"
ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query

During these tests only replication threads were running and only I was connected to the server.
I have access to some columns in the mentioned tabled or to the whole table, for sure.

If SHOW COLUMNS succeed I see a long-long table (formatted output by mysql cli) (------------------+-------------), so my X terminal hangs trying to show it.

Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(my_print_stacktrace+0x29) [0x7f67861d2179]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_fatal_signal+0x355) [0x7f6785d31465]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x103e0) [0x7f67853593e0]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_column_grant(THD*, st_grant_info*, char const*, char const*, char const*)+0x
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x4940e4) [0x7f6785c1d0e4]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x48a9db) [0x7f6785c139db]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_all_tables(THD*, TABLE_LIST*, Item*)+0x1c7) [0x7f6785c254c7]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_schema_tables_result(JOIN*, enum_schema_table_state)+0x287) [0x7f6785c27167]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec_inner()+0x590) [0x7f6785c0e310]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec()+0x44) [0x7f6785c104b4]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsig
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_select(THD*, LEX*, select_result*, unsigned long)+0x130) [0x7f6785c0d9b0]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x426a18) [0x7f6785bafa18]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_execute_command(THD*)+0x6170) [0x7f6785bbb830]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x274) [0x7f6785bbea54]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1bb6) [0x7f67
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_command(THD*)+0x16b) [0x7f6785bc1afb]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_handle_one_connection(THD*)+0x18c) [0x7f6785c82b0c]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_one_connection+0x37) [0x7f6785c82ce7]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x8484) [0x7f6785351484]
Apr 16 17:42:36 petcat mysqld[17478]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libc.so.6(clone+0x6d) [0x7f6782cdbf3d]
Apr 16 17:42:36 petcat mysqld[17478]: Trying to get some variables.
Apr 16 17:42:36 petcat mysqld[17478]: Some pointers may be invalid and cause the dump to abort.
Apr 16 17:42:36 petcat mysqld[17478]: Query (0x7f5c9fae7020): SHOW COLUMNS FROM `snap_2016_01_bob_live_tw`.`customer`
Apr 16 17:42:36 petcat mysqld[17478]: Connection ID (thread ID): 7313
Apr 16 17:42:36 petcat mysqld[17478]: Status: NOT_KILLED

Comment by Igor Pashev [ 2016-04-17 ]

Similar crash on DESCRIBE <table>:

Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(my_print_stacktrace+0x29) [0x7fcf4355b179]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_fatal_signal+0x355) [0x7fcf430ba465]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x103e0) [0x7fcf426e23e0]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_column_grant(THD*, st_grant_info*, char const*, char const*, char const*)+0x
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x4940e4) [0x7fcf42fa60e4]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x48a9db) [0x7fcf42f9c9db]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_all_tables(THD*, TABLE_LIST*, Item*)+0x1c7) [0x7fcf42fae4c7]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(get_schema_tables_result(JOIN*, enum_schema_table_state)+0x287) [0x7fcf42fb0167]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec_inner()+0x590) [0x7fcf42f97310]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(JOIN::exec()+0x44) [0x7fcf42f994b4]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsig
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_select(THD*, LEX*, select_result*, unsigned long)+0x130) [0x7fcf42f969b0]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(+0x426a18) [0x7fcf42f38a18]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_execute_command(THD*)+0x6170) [0x7fcf42f44830]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x274) [0x7fcf42f47a54]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1bb6) [0x7fcf
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_command(THD*)+0x16b) [0x7fcf42f4aafb]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(do_handle_one_connection(THD*)+0x18c) [0x7fcf4300bb0c]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7ygzwj9zfa1qzcv79gdbffnks57ip3i9-mariadb-10.1.13/bin/mysqld(handle_one_connection+0x37) [0x7fcf4300bce7]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libpthread.so.0(+0x8484) [0x7fcf426da484]
Apr 17 20:36:33 petcat mysqld[14540]: /nix/store/7b82878b8l4d136i6pxmwcc12sfsda33-glibc-2.21/lib/libc.so.6(clone+0x6d) [0x7fcf40064f3d]
Apr 17 20:36:33 petcat mysqld[14540]: Trying to get some variables.
Apr 17 20:36:33 petcat mysqld[14540]: Some pointers may be invalid and cause the dump to abort.
Apr 17 20:36:33 petcat mysqld[14540]: Query (0x7fc44125a020): describe bob_live_sg.supplier

Comment by Igor Pashev [ 2016-04-17 ]

Users run these queries because of MDEV-9614

Comment by Elena Stepanova [ 2016-04-17 ]

Thanks for the detailed description, now I can reproduce the problem.

MTR test case

--error 0,ER_CANNOT_USER
drop user foo@localhost;
--error 0,ER_CANNOT_USER
drop role r1;
drop database if exists db;
create role r1;
create user foo@localhost;
create database db;
create table db.t1 (i int);
grant select (i) on db.t1 to r1;
grant r1 to foo@localhost;
 
--connect (con1,localhost,foo,,)
set role r1;
describe db.t1;

Stack trace from 10.0 commit f8adeccd78bff80725a95b73447e34a5f4528179

#3  <signal handler called>
#4  0x00000000005f7011 in get_column_grant (thd=0x7f743fd488b0, grant=0x7f743d82b100, db_name=0x7f743d825118 "db", table_name=0x7f743d825120 "t1", field_name=0x7f743fd28fe9 "i") at /src/10.0/sql/sql_acl.cc:7456
#5  0x00000000006f568d in get_schema_column_record (thd=0x7f743fd488b0, tables=0x7f743d82ae60, table=0x7f743d854088, res=false, db_name=0x7f7447428300, table_name=0x7f74474282f0) at /src/10.0/sql/sql_show.cc:5490
#6  0x00000000006f1b37 in fill_schema_table_by_open (thd=0x7f743fd488b0, is_show_fields_or_keys=true, table=0x7f743d854088, schema_table=0x1616b20 <schema_tables+384>, orig_db_name=0x7f7447428300, orig_table_name=0x7f74474282f0, open_tables_state_backup=0x7f7447427cc0, can_deadlock=false) at /src/10.0/sql/sql_show.cc:4298
#7  0x00000000006f291b in get_all_tables (thd=0x7f743fd488b0, tables=0x7f743d8261a8, cond=0x0) at /src/10.0/sql/sql_show.cc:4782
#8  0x0000000000700a2e in get_schema_tables_result (join=0x7f743d828900, executed_place=PROCESSED_BY_JOIN_EXEC) at /src/10.0/sql/sql_show.cc:8168
#9  0x00000000006a7325 in JOIN::exec_inner (this=0x7f743d828900) at /src/10.0/sql/sql_select.cc:2538
#10 0x00000000006a6916 in JOIN::exec (this=0x7f743d828900) at /src/10.0/sql/sql_select.cc:2373
#11 0x00000000006a9cc3 in mysql_select (thd=0x7f743fd488b0, rref_pointer_array=0x7f743fd4cb88, tables=0x7f743d8261a8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7f743d8288e0, unit=0x7f743fd4c220, select_lex=0x7f743fd4c910) at /src/10.0/sql/sql_select.cc:3308
#12 0x00000000006a003f in handle_select (thd=0x7f743fd488b0, lex=0x7f743fd4c158, result=0x7f743d8288e0, setup_tables_done_option=0) at /src/10.0/sql/sql_select.cc:373
#13 0x00000000006748f2 in execute_sqlcom_select (thd=0x7f743fd488b0, all_tables=0x7f743d8261a8) at /src/10.0/sql/sql_parse.cc:5304
#14 0x000000000066ccdb in mysql_execute_command (thd=0x7f743fd488b0) at /src/10.0/sql/sql_parse.cc:2562
#15 0x0000000000677479 in mysql_parse (thd=0x7f743fd488b0, rawbuf=0x7f743d825088 "describe db.t1", length=14, parser_state=0x7f7447429650) at /src/10.0/sql/sql_parse.cc:6565
#16 0x0000000000669f45 in dispatch_command (command=COM_QUERY, thd=0x7f743fd488b0, packet=0x7f743fd4f371 "describe db.t1", packet_length=14) at /src/10.0/sql/sql_parse.cc:1308
#17 0x0000000000669212 in do_command (thd=0x7f743fd488b0) at /src/10.0/sql/sql_parse.cc:998
#18 0x00000000007878a7 in do_handle_one_connection (thd_arg=0x7f743fd488b0) at /src/10.0/sql/sql_connect.cc:1377
#19 0x0000000000787619 in handle_one_connection (arg=0x7f743fd488b0) at /src/10.0/sql/sql_connect.cc:1292
#20 0x0000000000df43a6 in pfs_spawn_thread (arg=0x7f743edbf9f0) at /src/10.0/storage/perfschema/pfs.cc:1860
#21 0x00007f74470eb0a4 in start_thread () from /lib64/libpthread.so.0
#22 0x00007f744547f04d in clone () from /lib64/libc.so.6

Comment by Igor Pashev [ 2016-04-18 ]

Sorry, couldn't wait :-D

diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index d34f04c..960efec 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -7645,7 +7645,7 @@ ulong get_column_grant(THD *thd, GRANT_INFO *grant,
       if (!grant_column)
         priv|= (grant->privilege | grant_table_role->privs);
       else
-        priv|= (grant->privilege | grant_table->privs | grant_column->rights);
+        priv|= (grant->privilege | grant_table_role->privs | grant_column->rights);
     }
   }
   mysql_rwlock_unlock(&LOCK_grant);

Comment by Igor Pashev [ 2016-04-18 ]

Thanks for the test case

Comment by Vicențiu Ciorbaru [ 2016-04-21 ]

Fixed with: https://github.com/MariaDB/server/commit/e5410da190d3e37af997f5b9bb1de2acb818f6f5

Thanks ip1981

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