Bug #45994 close connection handlerton method not called after the plugin is marked deleted
Submitted: 7 Jul 2009 8:54 Modified: 13 Jul 2009 19:29
Reporter: Thava Alagu Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Storage Engine API Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: CPU Architecture:Any

[7 Jul 2009 8:54] Thava Alagu
Description:
When a plugin is uninstalled, it is marked "deleted" and it 
should be unloaded later as soon as possible.

If some session(s) are open using the plugin that is being
unloaded, the close connection handlerton method is later
not called where it should be.

How to repeat:
mysql> install plugin innodb soname 'ha_innodb.so' ;
Query OK, 0 rows affected (0.94 sec)

mysql> show plugins ;
+------------+--------+----------------+--------------+---------+
| Name       | Status | Type           | Library      | License |
+------------+--------+----------------+--------------+---------+
| binlog     | ACTIVE | STORAGE ENGINE | NULL         | GPL     | 
| MyISAM     | ACTIVE | STORAGE ENGINE | NULL         | GPL     | 
| CSV        | ACTIVE | STORAGE ENGINE | NULL         | GPL     | 
| MEMORY     | ACTIVE | STORAGE ENGINE | NULL         | GPL     | 
| MARIA      | ACTIVE | STORAGE ENGINE | NULL         | GPL     | 
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL         | GPL     | 
| InnoDB     | ACTIVE | STORAGE ENGINE | ha_innodb.so | GPL     | 
+------------+--------+----------------+--------------+---------+
7 rows in set (0.01 sec)
 
mysql> use test;
Database changed
mysql>  create table t1 (i integer) engine='innodb' ;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from t1;
Empty set (0.00 sec)

mysql> uninstall plugin innodb;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------+
| Level   | Code | Message                                            |
+---------+------+----------------------------------------------------+
| Warning | 1620 | Plugin is busy and will be uninstalled on shutdown | 
+---------+------+----------------------------------------------------+
1 row in set (0.00 sec)

Now attach to mysqld process using gdb in another window :
  gdb --pid=<mysqld_pid>
gdb>  break  ha_close_connection
(and watch out if innobase_close_connection is called)

mysql> quit

[ The close connection handlerton method (innobase_close_connection in this
example) is not called. ]
[7 Jul 2009 9:29] 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/78092

2824 Thava Alagu	2009-07-07
      Bug#45994: close connection handlerton method not called after the plugin is marked deleted
      
      Close connection handlerton method should also be called for plugins which are
      in waiting state to be unloaded.
[13 Jul 2009 19:29] Sergei Golubchik
duplicate of bug#39053