Bug #47736 killing a select from a view when the view is processing a function, asserts
Submitted: 30 Sep 2009 7:52 Modified: 17 Jun 2010 22:42
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Views Severity:S1 (Critical)
Version:5.1.39-debug, 5.1.40-debug OS:Any
Assigned to: Sergei Glukhov CPU Architecture:Any
Tags: assertion, KILL

[30 Sep 2009 7:52] Shane Bester
Description:
killing a select from a view when the view is processing a function, asserts. stack trace from 5.1.39:

mysqld-debug: table.cc:3351: void TABLE_LIST::hide_view_error(THD*): Assertion `thd->is_error()' failed.

mysqld-debug.exe!_NMSG_WRITE()[crt0msg.c:198]
mysqld-debug.exe!abort()[abort.c:68]
mysqld-debug.exe!_wassert()[assert.c:212]
mysqld-debug.exe!TABLE_LIST::hide_view_error()[table.cc:3351]
mysqld-debug.exe!view_error_processor()[item.cc:7617]
mysqld-debug.exe!Name_resolution_context::process_error()[item.h:333]
mysqld-debug.exe!Item_func_sp::execute()[item_func.cc:5934]
mysqld-debug.exe!Item_func_sp::val_int()[item_func.h:1643]
mysqld-debug.exe!Item::send()[item.cc:5554]
mysqld-debug.exe!Item_ref::send()[item.cc:6058]
mysqld-debug.exe!select_send::send_data()[sql_class.cc:1604]
mysqld-debug.exe!end_send()[sql_select.cc:11990]
mysqld-debug.exe!do_select()[sql_select.cc:10868]
mysqld-debug.exe!JOIN::exec()[sql_select.cc:2209]
mysqld-debug.exe!mysql_select()[sql_select.cc:2400]
mysqld-debug.exe!handle_select()[sql_select.cc:268]
mysqld-debug.exe!execute_sqlcom_select()[sql_parse.cc:5011]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:2206]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5935]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1215]
mysqld-debug.exe!do_command()[sql_parse.cc:854]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1127]
mysqld-debug.exe!pthread_start()[my_winthread.c:85]
mysqld-debug.exe!_callthreadstart()[thread.c:295]
mysqld-debug.exe!_threadstart()[thread.c:277]
kernel32.dll!BaseThreadStart()

How to repeat:
#run a debug build of mysqld:

drop function if exists f1;
drop table if exists t1;
create table t1(a int)engine=myisam;
replace into t1 values (1);
create function f1 (inp text) returns int no sql return sleep(60);
create or replace view v1 as select f1('a') from t1;
select * from v1;

#in another connection, kill the 'select * from v1' query.
[30 Sep 2009 8:18] Valeriy Kravchuk
Verified just as described with recent 5.1.40-debug from bzr on Linux.
[1 Feb 2010 10:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/98800

3344 Sergey Glukhov	2010-02-01
      Bug#47736 killing a select from a view when the view is processing a function, asserts
      hide_view_error() does not take into account that therad query may be killed.
      Added a check for thd->killed.
     @ sql/table.cc
        hide_view_error() does not take into account that therad query may be killed.
        Added a check for thd->killed.
[3 Feb 2010 9:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/99024

3344 Sergey Glukhov	2010-02-03
      Bug#47736 killing a select from a view when the view is processing a function, asserts
      hide_view_error() does not take into account that therad query may be killed.
      Added a check for thd->killed.
      Addon: backported bug32140 fix from 6.0
     @ mysql-test/r/sp_notembedded.result
        test result
     @ mysql-test/t/sp_notembedded.test
        test case
     @ sql/sp.cc
        backported bug32140 fix from 6.0
     @ sql/table.cc
        hide_view_error() does not take into account that therad query may be killed.
        Added a check for thd->killed.
[3 Feb 2010 11:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/99043

3344 Sergey Glukhov	2010-02-03
      Bug#47736 killing a select from a view when the view is processing a function, asserts
      hide_view_error() does not take into account that therad query may be killed.
      Added a check for thd->killed.
      Addon: backported bug32140 fix from 6.0
     @ mysql-test/r/sp_notembedded.result
        test case
     @ mysql-test/t/sp_notembedded.test
        test case
     @ sql/sp.cc
        backported bug32140 fix from 6.0
     @ sql/table.cc
        Added a check for thd->killed.
[5 Feb 2010 9:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/99378

3363 Sergey Glukhov	2010-02-05
      Bug#47736 killing a select from a view when the view is processing a function, asserts
      hide_view_error() does not take into account that thread query may be killed.
      Added a check for thd->killed.
      Addon: backported bug32140 fix from 6.0
     @ mysql-test/r/sp_notembedded.result
        test case
     @ mysql-test/t/sp_notembedded.test
        test case
     @ sql/sp.cc
        backported bug32140 fix from 6.0
     @ sql/table.cc
        Added a check for thd->killed.
[1 Mar 2010 8:42] Bugs System
Pushed into 5.1.45 (revid:joro@sun.com-20100301083827-xnimmrjg6bh33o1o) (version source revid:joerg@mysql.com-20100212173307-ph563zr4wmoklgwd) (merge vers: 5.1.45) (pib:16)
[2 Mar 2010 14:32] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100302142746-u1gxdf5yk2bjrq3e) (version source revid:alik@sun.com-20100225090938-2j5ybqoau570mytu) (merge vers: 6.0.14-alpha) (pib:16)
[2 Mar 2010 14:37] Bugs System
Pushed into 5.5.3-m2 (revid:alik@sun.com-20100302072233-t3uqgjzdukt1pyhe) (version source revid:alexey.kopytov@sun.com-20100209075938-mmcnyf6w631ozc45) (merge vers: 5.5.2-m2) (pib:16)
[2 Mar 2010 14:42] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100302072432-k8xvfkgcggkwgi94) (version source revid:alik@sun.com-20100224135227-rcqs9pe9b2in80pf) (pib:16)
[8 Apr 2010 18:06] Paul DuBois
Noted in 5.1.45, 5.5.3, 6.0.14 changelogs.

For debug builds, killing a SELECT retrieving from a view that was
processing a function caused an assertion to be raised.
[17 Jun 2010 11:53] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:31] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609140708-52rvuyq4q500sxkq) (merge vers: 5.1.45-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:18] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)