Bug #86090 Index was out of range exception which kills workbench. [Force Restart Required]
Submitted: 26 Apr 2017 14:40 Modified: 30 Nov 2018 20:52
Reporter: Lee Butler Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:at least 6.3.8 & 6.3.9, maybe earlier. OS:Windows (10 )
Assigned to: CPU Architecture:Any
Tags: sql editor, workbench

[26 Apr 2017 14:40] Lee Butler
Description:
Workbench (or at least the current session in workbench) becomes unusable for executing queries if Workbench loses track of what is meant to be happening. 

After following the below steps, the application won't allow any more queries to be executed as it thinks it is still busy.

This is the second time in 2 days on 2 versions this has happened.

How to repeat:
1. Start a query which will take long enough to run that you can do something else.

2. Try and execute another query in another tab on the editor. 

3. Note that the spinner from the original query tab has now moved to the new tab, but no query has appeared in the output. 

4. Wait for the first query to finish.

5. See exception window (or a break in the debugger if you're debugging).

6. See that the second query has not executed, but workbench thinks it is still running, so that tab will remain busy. 

BONUS: Also note that you can close the tab which has the spinner on it, but the tab which has the completed query in it cannot be closed. Also after closing the "busy" tab things still cannot be executed. 

The application cannot be closed normally at this stage, nor can the connection which the error occurred in. The application must be killed by force, because "Cannot close SQL IDE while being busy".

Suggested fix:
I have no idea. I've usually got a clue but good luck mr/mrs developer on that one.
[27 Apr 2017 9:18] MySQL Verification Team
Hello Lee Butler,

Thank you for the report.
Observed this with WB 6.3.9 on Win7.

Thanks,
Umesh
[27 Apr 2017 9:19] MySQL Verification Team
Screenshot..

Attachment: 86090.png (image/png, text), 68.56 KiB.

[27 Apr 2017 9:21] MySQL Verification Team
## Created below schema, populated data

root@localhost [(none)]> create database if not exists test;
Query OK, 1 row affected, 1 warning (0.00 sec)

root@localhost [(none)]> use test;
Database changed
root@localhost [test]> drop table if exists keyvalue;
Query OK, 0 rows affected, 1 warning (0.00 sec)

root@localhost [test]> CREATE TABLE `keyvalue` (
    ->   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    ->   `name1` varchar(250),
    ->   `name2` varchar(250),
    ->   `name3` varchar(250),
    ->   `name4` varchar(250),
    ->   PRIMARY KEY (`id`, name1(10))
    -> ) ENGINE=innodb;

Query OK, 0 rows affected (0.00 sec)

root@localhost [test]>
root@localhost [test]> set @id:=0;
Query OK, 0 rows affected (0.00 sec)

root@localhost [test]>
root@localhost [test]>  insert into `keyvalue` values
    ->   (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000))
    -> ,  (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000))
    -> , (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000))
    -> , (@id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000));
Query OK, 4 rows affected (0.01 sec)
Records: 4  Duplicates: 0  Warnings: 0

root@localhost [test]>
root@localhost [test]>  insert into `keyvalue`(`id`,`name1`,`name2`,`name3`,`name4`)
    ->    select  @id:=@id+1,md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000),md5(rand()*1000000)  from
    ->     `keyvalue` k1, `keyvalue` k2, `keyvalue` k3, `keyvalue` k4,`keyvalue` k5,`keyvalue` k6, `keyvalue` k7, `keyvalue` k8, `keyvalue` k9,
    -> `keyvalue` k0,`keyvalue` ka, `keyvalue` kb, `keyvalue` kc, `keyvalue` kd limit  5000000;
Query OK, 5000000 rows affected (1 min 17.27 sec)
Records: 5000000  Duplicates: 0  Warnings: 0

## In first SQL tab

select 1,sleep(300);

Followed rest steps as outlined in the bug report and triggered the issue

######
14:38:19 [INF][        WQE.net]: Launching SQL IDE
14:38:20 [INF][        WQE.net]: SQL IDE UI is ready
14:39:20 [ERR][SQL Editor Form]: Error: Query execution has been stopped, the connection to the DB server was not restarted, any open transaction remains open
14:44:28 [ERR][      Workbench]: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Exception = System.ArgumentOutOfRangeException
Message = Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
FullText = System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at MySQL.Controls.FlatTabControl.SetBusy(Int32 index, Boolean busy)
   at MySQL.GUI.Workbench.SqlIdeForm.SetBusyTab(Int32 tab)
   at boost.detail.function.void_function_invoker1<void (__cdecl*)(int const &),void,int const &>.invoke(function_buffer* function_ptr, Int32* a0)
   at boost.function1<void,int const &>.()(function1<void\,int const \&>* , Int32* a0)
   at wb.WBContext.flush_idle_tasks(WBContext* )
   at MySQL.Workbench.WbContext.flush_idle_tasks()
   at MySQL.GUI.Workbench.Program.timer_Tick(Object sender, EventArgs e)
[11 Sep 2017 5:40] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=81625  marked as duplicate of this one.
[26 Feb 2018 19:18] MySQL Verification Team
https://bugs.mysql.com/bug.php?id=89704 marked as duplicate of this one.
[30 Oct 2018 12:34] MySQL Verification Team
Bug #92984 marked as duplicate of this one
[30 Nov 2018 20:52] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 8.0.14 release, and here's the changelog entry:

Multiple SQL queries executed sequentially in separate tabs did not
resolve as expected on Windows. The first query ran to completion, but the tab would
not close. The second query never finished. Thereafter, no additional
queries could run and the program would not exit.

Thank you for the bug report.