Bug #109336 Workbench crashes when editing a table with a JSON column
Submitted: 12 Dec 2022 1:31 Modified: 27 Dec 2022 13:18
Reporter: Maks Nowak Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:8.0.31 OS:Windows (Windows 10 Version 21H2)
Assigned to: CPU Architecture:Any (AMD Ryzen 7 2700)
Tags: json

[12 Dec 2022 1:31] Maks Nowak
Description:
When inserting a column with a JSON type the app closes without any error message. The column is successfully created and log files show that the changes were applied but when I try to edit the table after opening the app again, it crashes in the same way.
Once I remove the JSON column by a query, I can edit the table again.

I ran it in debug mode to get this exception in the console:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at mforms.TreeView.overlay_icon_for_node_clicked(TreeView* , TreeNodeRef* , Int32 )
   at MformsTree.OnMouseDown(MouseEventArgs args)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.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)

I ran the memory diagnostic tool and nothing wrong was found.

How to repeat:
1. Edit a table via the spanner icon
2. Create a column with the JSON data type
3. Apply the changes

Then it loads for a moment and closes.
[23 Dec 2022 12:17] MySQL Verification Team
Hello Maks Nowak,

Thank you for the bug report.
Could you please share us the table structure with sample data to reproduce this issue at our end? Thanks.

Regards,
Ashwini Patil
[24 Dec 2022 0:16] Maks Nowak
Before adding the JSON row, the table definition is as follows:

CREATE TABLE `games` (
  `game_id` int(6) unsigned zerofill NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`game_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci

Then I add a new field: I name it "settings" and select the "JSON" datatype. Then I click apply and that's when it crashes.

Checking the table definition again returns this statement:

CREATE TABLE `games` (
  `game_id` int(6) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`settings`)),
  PRIMARY KEY (`game_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci

Thank you,

Maks
[27 Dec 2022 13:18] MySQL Verification Team
Hello Maks Nowak,

Thank you for the details.
I tried to reproduce your issue on windows 10 with workbench 8.0.31 using table provided and followed exact steps but I am not seeing any issues at my end.

Regards,
Ashwini Patil
[27 Dec 2022 13:24] MySQL Verification Team
8.0.31 test results

Attachment: 109336_test_results.png (image/png, text), 160.41 KiB.