Bug #60041 Editing table on similar scheme, trigger causes the memory error, (SQL editor)
Submitted: 9 Feb 2011 9:41 Modified: 8 Aug 2012 21:30
Reporter: Kees Bakker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:5.2.38 OS:Windows (windows 7)
Assigned to: CPU Architecture:Any

[9 Feb 2011 9:41] Kees Bakker
Description:
We are using 4 schema's to represent our data.
When editing table 'userLead' in the main schema we do NOT have a problem.
When we try editing the same table on different schema we get the memory message.

Problem seems to occur when using triggers.
Both those tables have about the same trigger on beforeDelete.

How to repeat:
Create 2 schema's; IE test and test_NL
create 2 identical tables.
Create a trigger on table1 and the same trigger on the '_NL' version, try to use beforeDelete.

When setup, try to edit the test_NL.table1 table, this should trigger the error.

Suggested fix:
Fix is not to have this problem at all, its a simple edit table action.
Should get the edit table popup screen.
[9 Feb 2011 9:45] Kees Bakker
Had the wrong category.
[9 Feb 2011 10:29] Valeriy Kravchuk
If you'll ever get this problem again, please, right click somewhere in the error dialog box with no text and use Copy stack trace to clipboard context menu item. Send stack trace to this report.
[9 Feb 2011 11:57] Kees Bakker
Allright! Didn't know that sorry. Anyways, I always get this error when editing the second table:

Ill translate the dutch part:
'Poging tot het lezen of schrijven van beveiligd geheugen. Dit duidt er vaak op dat ander geheugen is beschadigd.'
means:
Attempt to read or write secure memory. This often indicates that other memory is damaged.

Exception = System.AccessViolationException
Message = Poging tot het lezen of schrijven van beveiligd geheugen. Dit duidt er vaak op dat ander geheugen is beschadigd.
FullText = System.AccessViolationException: Poging tot het lezen of schrijven van beveiligd geheugen. Dit duidt er vaak op dat ander geheugen is beschadigd.
   bij MySQL.Grt.ListModel.activate_popup_item_for_nodes(String name, List`1 nodes)
   bij MySQL.GUI.Workbench.SqlIdeMenuManager.OnMenuItemClick(Object sender, EventArgs e)
   bij System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   bij System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   bij System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   bij System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   bij System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   bij System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   bij System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   bij System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   bij System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   bij System.Windows.Forms.Control.WndProc(Message& m)
   bij System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   bij System.Windows.Forms.ToolStrip.WndProc(Message& m)
   bij System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bij System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[9 Feb 2011 17:04] MySQL Verification Team
Could you please provide the model file?. Thanks in advance.
[5 May 2011 10:57] Johannes Taxacher
Hi Kees,

could you eventually check if the problem still occurs for you in most recent version?
thanks in advance
[6 May 2011 7:49] Kees Bakker
Yes it still happens in version 5.2.33 CE, revision 7508.

Only difference with this version is that the Mysql Workbench crashes and doesn't display a message or other information.
[7 Jun 2011 14:05] Armando Lopez Valencia
Hello Kees.
The new WB version 5.2.34 is out (http://dev.mysql.com/downloads/workbench/5.2.html).
Can you please try with this new version and let us know the outcome?
Besides that can you please send us your system info?
On Workbench: Help -> System info.
Thanks.
[7 Jun 2011 14:24] Kees Bakker
No it still happends in this build.
[7 Jun 2011 23:07] MySQL Verification Team
I got a crash when exiting WorkBench after the edit table action.

Description:
  Stopped working

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	MySQLWorkbench.exe
  Application Version:	5.2.34.7780
  Application Timestamp:	4ddbbfe9
  Fault Module Name:	unknown
  Fault Module Version:	0.0.0.0
  Fault Module Timestamp:	00000000
  Exception Code:	c0000005
  Exception Offset:	cccccccc
  OS Version:	6.0.6002.2.2.0.256.1
  Locale ID:	1046
[24 Aug 2011 20:36] Johannes Taxacher
Is the problem appearing in the SQL Development section (floating table editors) or in the modelling section (docked editors). I was yet unable to reproduce and I was wondering, since the bug is filed in the SQL-Editor category while you have supplied a workbench file to replicate the problem.
Could you please clarify?
thanks in advance
[24 Sep 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[25 Sep 2011 11:44] Kees Bakker
The problem exists in editing the table in the SQL editor, not the modeling file.

I've supplied a workbench file because it was asked
[25 Sep 2011 11:44] Kees Bakker
The problem exists in editing the table in the SQL editor, not the modeling file.

I've supplied a workbench file because it was asked
[3 Oct 2011 14:16] MySQL Verification Team
Please try version 5.2.35. Thanks.
[4 Nov 2011 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[4 Nov 2011 8:31] Kees Bakker
Sorry didn't see the change of 4th of october.
Same problems occurs.
I open my sql editor.
Go to leadsystem_NL_deleted schema
right click the userLead table and click 'alter table'
Then mysql workbench instantly crashes.
[5 Nov 2011 16:45] Valeriy Kravchuk
What exact server version, 5.x.y, are you working with?
[7 Nov 2011 7:46] Kees Bakker
Information from phpMyAdmin
Server version: 5.0.51a-3ubuntu5.8-log
Protocol version: 10
MySQL charset:  UTF-8 Unicode (utf8)

Other information
Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 PHP/5.2.4-2ubuntu5.18 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g mod_perl/2.0.3 Perl/v5.8.8
MySQL client version: 5.0.51a
PHP extension: mysqli
[7 Nov 2011 12:53] Alfredo Kojima
Does this crash happen for any table in that leadsystem_NL_deleted schema? Or only with userLead? Can
can you type show create userLead from the SQL editor and then paste the contents? If the table has foreign keys a dump of that schema (no data) could help us repeat the bug.

Another thing, do you have access to other machines where you could run WB from and see if the same happens? If possible both Windows and Linux machines.
[8 Nov 2011 7:38] Kees Bakker
Yes it only happens on the userLead table.
And also on the ones in leadsystem_NL_exported and leadsystem_NL_invoiced.

I cannot confirm this also happens on linux systems, I do not have access to one.

But it also happens on my colleague's windows 7 computer.

And note that if I remove the trigger ON BEFORE DELETE, this crash doesn't trigger.

CREATE TABLE `userLead` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `campaign_id` smallint(5) unsigned NOT NULL,
  `userTransaction_id` int(11) unsigned NOT NULL,
  `userExtraData_id` int(11) unsigned default NULL,
  `revenue` decimal(10,2) unsigned NOT NULL,
  `ip` int(11) unsigned default NULL,
  `status` enum('INVOICED','EXPORTED','PENDING','DELETED','AUTHENTICATE') collate latin1_general_ci NOT NULL default 'DELETED',
  `defaultSurveyAnswer` varchar(128) collate latin1_general_ci default NULL,
  `accountNumber` varchar(45) collate latin1_general_ci default NULL,
  `payment` decimal(12,2) default '0.00',
  `insertTime` timestamp NULL default NULL,
  `updateTime` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `delete_id` mediumint(9) default NULL,
  `surveyQuestion_id` smallint(5) unsigned default NULL,
  PRIMARY KEY  (`id`),
  KEY `fk_userLeads_userExtraData1` (`userExtraData_id`),
  KEY `fk_userLeads_campaignData1` (`campaign_id`),
  KEY `fk_userLeads_user_transaction1` (`userTransaction_id`),
  CONSTRAINT `fk_userLeads_campaignData1` FOREIGN KEY (`campaign_id`) REFERENCES `leadsystem_NL`.`campaign` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_userLeads_userExtraData1` FOREIGN KEY (`userExtraData_id`) REFERENCES `leadsystem_NL`.`userExtraData` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_userLeads_user_transaction1` FOREIGN KEY (`userTransaction_id`) REFERENCES `userTransaction` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=24840518 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
[13 Dec 2011 13:46] MySQL Verification Team
Please try version 5.2.36. Thanks.
[13 Dec 2011 15:10] Kees Bakker
Still not working.
[20 Jan 2012 3:06] Alfredo Kojima
I was able to repeat with the schema in the provided model with a 5.0 server after making some changes
to make the script execute until the end.
[20 Jan 2012 3:13] Alfredo Kojima
FYI what is causing the crash is that the trigger code refers to tables in a schema different from the one where it is contained. This is a bug and should be fixed.
[23 Jan 2012 7:35] Kees Bakker
Yes that is right. 
But the crash only happens on the schema's _DELETED, _INVOICED and _PENDING.
Not with the default schema.
So why does it happen only on those schema's?
[27 Feb 2012 11:50] Kees Bakker
Looks like this is resolved in 5.2.38
[8 Aug 2012 21:30] Philip Olson
Fixed as of 5.2.41, and here's the changelog entry:

A crash would occur if trigger code referred to tables in a
schema different from the one where it is contained.