Bug #88342 MySQL workbench freezes for around 20 seconds on first query execution
Submitted: 3 Nov 2017 10:35 Modified: 3 Nov 2017 13:12
Reporter: Borre Mosch Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.9 OS:Microsoft Windows (Windows 10 x64)
Assigned to: CPU Architecture:Any

[3 Nov 2017 10:35] Borre Mosch
Since installing the latest MySQL workbench version (6.3.9), whenever I execute the first query for a connection, the program hangs for around 20 seconds. Subsequent queries do not freeze the application. If I open a new connection/tab to a DB, again the first query in the new tab will freeze the application.

How to repeat:
1. Open MySQL workbench
2. Open a new connection
3. execute any query
[3 Nov 2017 10:43] Borre Mosch
By looking at the logs, I found out that the freeze was caused by the parsing of the history in the 'sql_history' folder. The program was unable to parse some of the files, presumably because they were generated by a previous version of MySQL workbench.

My belief is that MySQL should discard of old/corrupt history files so that it will not hang every time one executes a query for the first time without an apparent reason.
[3 Nov 2017 11:49] Chiranjeevi Battula
Hello Borre,

Thank you for the bug report.
This reminds me of Bug #88173, could you please confirm if you are affected by Bug #88173 i.e hangs on the first query on a fresh connection? 
If it is not  the case then may I request you to please provide complete repeatable test case (steps, screenshot etc. - please make it as private if you prefer) to confirm this issue at our end?

[3 Nov 2017 11:57] Borre Mosch
Hi Chiranjeevi,

Thanks for your reply. Bug #88173 sounds exactly like my bug.

It seems that workbench is trying to parse my sql history when executing the first query, and fails to do so. After executing the first query (which takes 20 seconds), my log file is filled half a megabyte of entries like this:

11:30:19 [ERR][ sqlide-history]: Can't parse <ENTRY timestamp='17:44:16'>INSERT INTO `scrambled_backend_v2`.`genericproduct` VALUES&#x0A; (344749, 'kippenbouillon', 0),&#x0A;	(344750, 'bakpoeder', 0),&#x0A;	(344751, 'ma&iuml;zena', 0);
11:30:19 [ERR][  XML Functions]: LibXml: Entity: line 1: 
11:30:19 [ERR][  XML Functions]: LibXml: parser 
11:30:19 [ERR][  XML Functions]: LibXml: error : 
11:30:19 [ERR][  XML Functions]: LibXml: Entity 'iuml' not defined

11:30:19 [ERR][  XML Functions]: LibXml: , 'kippenbouillon', 0),&#x0A;	(344750, 'bakpoeder', 0),&#x0A;	(344751, 'ma&iuml;

11:30:19 [ERR][  XML Functions]: LibXml:                              	                               	                 ^
[3 Nov 2017 12:47] Chiranjeevi Battula
Please provide more information about server and connection (local, remote, etc  - please make it as private if you prefer) to confirm this issue at our end?
[3 Nov 2017 12:50] Borre Mosch
The issue occurs both when connecting locally over a regular tcp connection, and when connectiong remotely over ssh.

In other words, the type of connection does not seem to matter.
[3 Nov 2017 13:00] Chiranjeevi Battula
Hello Borre,

Thank you for the feedback.
I could not repeat the issue at our end using with MySQL workbench 6.3.9 version with MySQL 5.7.20 and 5.6.38 versions.
If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

[3 Nov 2017 13:12] Borre Mosch
I have uploaded the sql_history folder from %APPDATA%/Mysql/Workbench that was causing the freezes. This should help you reproduce the issue.

I seem to be unable to re-open this ticket, however.
[28 Mar 2018 21:19] Clayton Nicholson
I had the same issue. For me, the entity "nbsp" was not defined, so I went into the sql_history folder and replaced all the &nbsp; entries with a space, and that resolved the issue. If you don't care about your history, you could just delete or backup all the stuff in sql_history. 

In the example above, it says 'iuml' is not defined. You would need to replace the & in that query with either &amp; or maybe try &#38;

You'd have to do this for everything in the log file that is not defined.
[28 Mar 2018 21:24] Clayton Nicholson
Sorry, I just realized &iuml; is lowercase i with an umlat. I think you need to replace all the entity names with the corresponding entity number, which for &iuml; is &#239;
[19 Jun 2018 11:14] Lucian Costin
I have the same situation since a few days. Unfortunately, Mysql Workbench doesn't recover at all anynmore, it just hangs like that. 
My trouble was from the entity uuml;
I've removed the history files found under \AppData\Roaming\MySQL\Workbench\
and now it runs normally