Bug #103560 "Index was out of range" when closing tab during right-most tab's running query
Submitted: 3 May 2021 17:02 Modified: 3 May 2021 18:42
Reporter: Jason Brunette Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.24 OS:Windows
Assigned to: CPU Architecture:Any

[3 May 2021 17:02] Jason Brunette
Description:
An "Unexpected Error" dialog box appears and Workbench is rendered unusable if the right-most Query tab's query completes after a tab to the left has been closed.

How to repeat:
Steps to reproduce
1. Open 2 query tabs.
2. In the second tab, execute query "SELECT SLEEP(10)"
3. Close the first tab.
4. When the query returns, a "MySQL Workbench Unexpected Error" dialog box appears with the following information:

"Index was out of range..."
"Parameter name: index"

Workbench is now in an unstable state and will refuse to close, requiring "End Task" via the Windows Task Manager.

A related issue exists regarding a tab's spinner remaining forever after its query completes:
1. Open 3 query tabs.
2. In the second tab, execute query "SELECT SLEEP(10)"
3. Close the first tab.
4. When the query returns, the tab that ran the query will continue to show the spinner animation instead of being switched to the X. The spinner still acts like the X and lets you close the tab, and no Workbench instability is observed.

Suggested fix:
Cause
- Code is most likely storing the index position of the executing tab and attempts to reference the tab in the tab bar by that position when the query completes. If there is no longer a tab at that index when the query completes, however, an error occurs when Workbench tries to change the tab's spinner back to X.

Fix
- Use another means of targeting tab that just finished the query, or loop through all tabs and set all icons to X...
[3 May 2021 18:42] MySQL Verification Team
Thank you for the bug report.