Bug #98345 MySQL Workbench crashes during update model
Submitted: 24 Jan 2020 9:32 Modified: 17 Feb 2020 13:23
Reporter: M O Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.19 OS:Windows
Assigned to: CPU Architecture:x86
Tags: workbench update model crash

[24 Jan 2020 9:32] M O
Description:
After moving from MySQL 5.7 to MySQL 8, Workbench wants to recreate all foreign keys. This is no acceptable, so I want to update the model instead. Updating some tables in model is working fine, but some tables are causing a Workbench crash. This exception is shown in console:
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 System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at mforms.MenuItem.callback(MenuItem* )
   at MenuItemEventTarget.MenuItemClick(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.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)

Example - workbench wants to update the table with this sql:
ALTER TABLE `db`.`my_table` 
ADD CONSTRAINT `fk_my_table_other_table1`
  FOREIGN KEY (`other_table`)
  REFERENCES `db`.`other_table` (`id`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;
my_table create script (from workbench "send to sql editor)
  CREATE TABLE `my_table` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `value` float NOT NULL,
  `year` int(4) NOT NULL,
  `other_table` int(11) NOT NULL,
  `hourly_rate_dir` float NOT NULL DEFAULT '0',
  `hourly_rate_indd` float NOT NULL DEFAULT '0',
  `version` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `year_UNIQUE` (`year`,`other_table`),
  KEY `fk_ltustandard_costcenter1_idx` (`other_table`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci;

When I select update model on this table, Workbench crashes.

Dump file: https://gofile.io/?c=PRuYEM

Cannot test this with latest version because of bug #98344.

How to repeat:
Update model with fk changes - on some tables the Workbench crashes.
[24 Jan 2020 11:22] MySQL Verification Team
Please try version WorkBench version 8.0.19.
[24 Jan 2020 12:54] M O
As I wrote, cannot test with latest version 8.0.19 because of bug #98344.
[25 Jan 2020 9:51] M O
I checked it with 8.0.19 and it behaves same - update model causes crash.
[11 Feb 2020 6:16] MySQL Verification Team
Hello,

Thank you for the bug report.
I tried to reproduce your issue on windows 10 with workbench 8.0.19 and sample table mentioned in the bug but I am not seeing any issues at my end. To investigate further this issue at our end, may I kindly request you to provide a SQL file. Thanks.

Regards,
Ashwini Patil
[11 Feb 2020 7:58] M O
I added a create sql script and a model file. Create the schema with the script and update the model from db (not db from model) using Synchronize. My workbench crashes when I do it.
[17 Feb 2020 13:23] MySQL Verification Team
Hello,

Thank you for the model file and SQL script.
Verified as described.

Regards,
Ashwini Patil
[17 Feb 2020 13:24] MySQL Verification Team
8.0.19 test results

Attachment: 98345.png (image/png, text), 84.03 KiB.