Bug #91372 sql_history causes first query to run slow
Submitted: 22 Jun 2018 11:17 Modified: 23 Jul 2018 15:37
Reporter: Stian Skjerveggen Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.10 OS:Windows (Microsoft Windows 10 Pro)
Assigned to: Assigned Account CPU Architecture:Any
Tags: WBBugReporter

[22 Jun 2018 11:17] Stian Skjerveggen
Description:
I had three years of sql_history logs in appdata\roaming\mysql\workbench\sql_history. One of them (approx 10mb) had a few xml parser errors according to wb.log. All of this caused the first query (for example SELECT 1;) to make workbench unresponsive for up to a minute. I'm guessing the query wasnt executed after workbench tried to parse 3 years of sql history.

After deleting all files in sql_history, first query ran as expected.

How to repeat:
Put a 10mb file in %appdata%/mysql/workbench/sql_history with a content that causes the xml parser to fail.

Excerpt from wb.log:
--
13:04:44 [ERR][ sqlide-history]: Can't parse <ENTRY timestamp='~'>INSERT INTO `bruker` VALUES (1,@customer_name,@customer_password,@customer_name,&apos;Admin&apos;,&apos;admin&apos;,&apos;webtv&apos;,&apos;webtv;0;0&apos;,&apos;bruker&apos;,&apos;&#x01;&apos;,1)</ENTRY>, of file: C:\Users\stian\AppData\Roaming\MySQL\Workbench\sql_history\2015-07-30
...
13:04:45 [ERR][  XML Functions]: LibXml:                                                                                ^

13:04:45 [ERR][  XML Functions]: LibXml: Entity: line 1: 
13:04:45 [ERR][  XML Functions]: LibXml: parser 
13:04:45 [ERR][  XML Functions]: LibXml: error : 
13:04:45 [ERR][  XML Functions]: LibXml: xmlParseCharRef: invalid xmlChar 
value 1
13:04:45 [ERR][  XML Functions]: LibXml: t Git&lt;/a&gt;&lt;/iframe&gt;&apos;,&apos;direktesending.png&apos;,&apos;&#x01;
...
13:05:19 [ERR][  XML Functions]: LibXml: Entity: line 1: 
13:05:19 [ERR][  XML Functions]: LibXml: parser 
13:05:19 [ERR][  XML Functions]: LibXml: error : 
13:05:19 [ERR][  XML Functions]: LibXml: Entity 'oslash' not defined
13:05:19 [ERR][  XML Functions]: LibXml:  '#ffffff', NULL, NULL, 'arkiv'),&#x0A;	(11, NULL, 1, 'Byutvikling, milj&oslash;
--

.. and so on for approx 900kbs.

I'm not attaching the log files as they may contain sensitive data.

Suggested fix:
Don't parse three year old sql_history. Or don't parse history at all - I can't seem to find anywhere it is actually used.
[23 Jun 2018 15:37] MySQL Verification Team
Thank you for the bug report. I noticed the behavior reported only once after that is created a new small history file with development version 8.0.11 rc, so please try it. Thanks.
[11 Jul 2018 15:23] MySQL Verification Team
https://bugs.mysql.com/bug.php?id=91601 marked as duplicate of this one.
[24 Jul 2018 1: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".