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.