Segfault on SHOW TABLE STATUS (mysqldump) of nested views

Bug #682525 reported by Arjen Lentz
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MariaDB
New
Undecided
Oleksandr "Sanja" Byelkin

Bug Description

mysqld (MariaDB) 5.2.3 segfaults during a mysqldump operation, the environment contains nested views.
Views structure, general query log, and error log with stacktrace attached.
Base table structure not currently available as the dump won't complete - will retrieve separately if necessary, but the above info may already allow you to catch the problem.

In stock (Oracle) mysql 5.1.41-3ubuntu12.7 the server the same happens, so the problem is not restricted to MariaDB.

Revision history for this message
Arjen Lentz (arjen-lentz) wrote :
Revision history for this message
Arjen Lentz (arjen-lentz) wrote :
Revision history for this message
Arjen Lentz (arjen-lentz) wrote :

note that the crash happens in the view hierarchy, it's not at the base table level.

Revision history for this message
Arjen Lentz (arjen-lentz) wrote :

This db (on the same server) does not exhibit the problem (so taking a complete mysqldump was ok).
The main difference with this db is that the definer on views here is 'root'@'%' rather than 'root'@'localhost' as was the case with the schema that causes the crashes, and stored functions in the problem db are declared as DETERMINISTIC whereas in this schema they are not.

Revision history for this message
Coen Hyde (coen-hyde) wrote :

Interestingly, manually running the query
   show table status like 'view\_course\_scheme\_units'
   (as shown in the errorlog - the command that triggers the crash)
from mysql cmdline client on its own doesn't cause crash. So it might be the sequence of events rather than the individual command.

Revision history for this message
Coen Hyde (coen-hyde) wrote :

Also submitted at http://bugs.mysql.com/58543

Revision history for this message
Coen Hyde (coen-hyde) wrote :

When using the complete views structure, you actually get a different error
  mysqldump: Couldn't execute 'SHOW FIELDS FROM `s_c_master`': View 'catt_migrate4.s_c_master' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

the crash occurs when this top level view is removed and then mysqldump is run again.

Revision history for this message
Coen Hyde (coen-hyde) wrote :

The original db that doesn't exhibit the problem doesn't contain functions declared DETERMINISTIC / CONTAINS SQL

In the problem db with all the options in (functions attached), the mysqldump error is

mysqldump: Couldn't execute 'SHOW FIELDS FROM `s_c_master`': View 'catt_migrate4.s_c_master' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

The crashing starts when the top level view is removed from the schema.

In the problem db if i remove all CONTAINS SQL, MODIFIES SQL DATA and READS SQL DATA options, I get a segfault/crash:
  mysqldump: Couldn't execute 'show table status like 's\_c\_master'': Lost connection to MySQL server during query (2013)

When all the options are removed, no segfault occurs.
So this is starting to look like an interaction problem with stored procs?

Revision history for this message
Coen Hyde (coen-hyde) wrote :

If we modify the following function by removing the DETERMINISTIC option (all other functions are still as they are with deterministic and CONTAINS options), no crash or error occurs. So this is the function that "triggers" the problem:

DELIMITER |

CREATE DEFINER = 'root'@'localhost' FUNCTION userbelongstoorg ()
RETURNS int(11)
CONTAINS SQL
RETURN @userBelongsToOrg|

DELIMITER ;

Revision history for this message
Coen Hyde (coen-hyde) wrote :

(yes we know the above function is technically non-deterministic - the option was a "code bug").
Still, mysqld crashed and it shouldn't, so it's a bug.

Revision history for this message
Arjen Lentz (arjen-lentz) wrote :

For reference, the problem also exists in 5.1.51 (since MariaDB 5.2.3 incorporates code up to that upstream version). So the only unknown right now might be 5.1.53 - however looking at the 5.1.53 change log
http://dev.mysql.com/doc/refman/5.1/en/news-5-1-53.html I see nothing even remotely
related to this.

Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

Is it copy of this bug: http://bugs.mysql.com/bug.php?id=58543 ?

Changed in maria:
assignee: nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin)
Changed in maria:
milestone: none → 5.2
milestone: 5.2 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.