Bug #91559 MySQL Workbench Crash
Submitted: 6 Jul 2018 3:46 Modified: 19 Sep 2018 17:24
Reporter: Zeng Sheng Liu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:8.0.11 OS:Windows (10)
Assigned to: CPU Architecture:Any

[6 Jul 2018 3:46] Zeng Sheng Liu
Description:
In the sql editor, when typing queries (especially those that are copied from another file), when typing column name (which should show the hint), workbench freeze (a second or 2) and then crash.  If I don't type anything, it wouldn't do anything.

C:\Program Files\MySQL\MySQL Workbench 8.0 CE>
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at wb.WBContext.flush_idle_tasks(WBContext* , Boolean )
   at MySQL.Workbench.WbContext.flush_idle_tasks(Boolean force)
   at MySQL.GUI.Workbench.Program.timer_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at MySQL.GUI.Workbench.Program.Main(String[] Args)

How to repeat:
I first write the inner query in a separate window without issue:
SELECT StatusName
FROM (
	SELECT
		ALB.AdjLoanBridgeID,
		AdjLoanStatusID,
		@RowNumber:=CASE
			WHEN @LoanID = L.LoanID THEN @RowNumber + 1
			ELSE 1
		END AS Rank,
		@LoanID:= L.LoanID AS LoanID
	FROM AdjLoanStatusLog ALSL
	JOIN AdjLoanBridge ALB ON ALSL.AdjLoanBridgeID = ALB.AdjLoanBridgeID
    JOIN Loan L ON ALB.LoanID = L.LoanID
    WHERE VendorLoanCode = ''
    ORDER BY AdjLoanStatusDateID DESC, AdjLoanStatusTimeID DESC
) ALSL
JOIN Status S ON ALSL.AdjLoanStatusID = S.StatusID
WHERE Rank = 1;

Then I copied it into a separate window

Right after the select line, I then try to edit the query with the following:
SELECT StatusName
FROM AdjLoanStatusLog ALSL
JOIN AdjLoanBridge ALB ON ALSL.A
FROM (
	SELECT
		ALB.AdjLoanBridgeID,
		AdjLoanStatusID,
		@RowNumber:=CASE
			WHEN @LoanID = L.LoanID THEN @RowNumber + 1
			ELSE 1
		END AS Rank,
		@LoanID:= L.LoanID AS LoanID
	FROM AdjLoanStatusLog ALSL
	JOIN AdjLoanBridge ALB ON ALSL.AdjLoanBridgeID = ALB.AdjLoanBridgeID
    JOIN Loan L ON ALB.LoanID = L.LoanID
    WHERE VendorLoanCode = ''
    ORDER BY AdjLoanStatusDateID DESC, AdjLoanStatusTimeID DESC
) ALSL
JOIN Status S ON ALSL.AdjLoanStatusID = S.StatusID
WHERE Rank = 1;

(I know this is not the right syntax but I am in the process or re-writing)

The Workbench then freeze for a second or 2 and crash.
[6 Jul 2018 12:13] MySQL Verification Team
Thank you fro the bug report. The tables and data are need to repeat the issue. If yes please provide it (use Files tab). Thanks.
[6 Jul 2018 14:28] Zeng Sheng Liu
I attached the export of the schema + data into the ftp with filename mysql-bug-data-91559.zip
[9 Jul 2018 13:21] MySQL Verification Team
Thank you for the feedback and requested details.
Observed this on Win7, with provided SQL statements and supporting schema.

##

C:\>cd C:\Program Files\MySQL\MySQL Workbench 8.0 CE\

C:\Program Files\MySQL\MySQL Workbench 8.0 CE>MySQLWorkbench.exe -log-level=debug3

## Copy first SQL statement from report to first tab, open second tab and paste it again - after SELECT.. enter and then type FROM.. <-- WB crashes here

C:\Program Files\MySQL\MySQL Workbench 8.0 CE>
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indi
cation that other memory is corrupt.
   at wb.WBContext.flush_idle_tasks(WBContext* , Boolean )
   at MySQL.Workbench.WbContext.flush_idle_tasks(Boolean force)
   at MySQL.GUI.Workbench.Program.timer_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FP
ushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at MySQL.GUI.Workbench.Program.Main(String[] Args)

Regards,
Umesh
[19 Sep 2018 17:24] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 8.0.13 release, and here's the changelog entry:

After copying a query into a second query editor, auto-completion did not
display the related column names. Instead, when auto-completion was
engaged, MySQL Workbench stopped working.

Thank you for the bug report.
[16 Feb 2020 1:07] Mihai Zugravescu
Hi,
I have 8.0.19 version and the same think happening! 
DO you have any solution?

Thank you!
Mihai