Bug #74020 Complete System Crash on Beautify
Submitted: 22 Sep 2014 19:53 Modified: 9 Jan 2015 9:44
Reporter: jason neumann Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S1 (Critical)
Version:6.2.2 OS:Windows (7)
Assigned to: CPU Architecture:Any
Tags: beautify, crash, sql editor

[22 Sep 2014 19:53] jason neumann
Description:
I've experienced several system crashes since installing MySql Workbench 6.2.2 rc 64bit. It first occurred when trying to beautify a rather long query. The whole computer locked up. I could move my mouse but couldn't click on anything. ctrl+alt+del wouldn't respond either. After a hardware shutdown and restarting the system I tried beautifying the same query and it worked just fine. Later I was trying to beautify a much smaller (~300 char) query and it happened again. I had my cursor at the end of the query and hit ctrl+B and instead of it beautifying it added a strange character on the screen. it had a black background and 3 white characters inside, I think they were STB or something like that. I deleted the character and hit ctrl+B again and the whole system locked up. 

How to repeat:
Not always repeatable.
[23 Sep 2014 7:26] MySQL Verification Team
Hello Jason,

Thank you for the report.
I'm able to hit this issue 5/10 times on Win7 with WB 6.2.2 when using a very long query for formatting.

Thanks,
Umesh
[23 Sep 2014 7:39] MySQL Verification Team
// How to trigger

SELECT  word
,       CONCAT     (
            SUBSTRING_INDEX(
                GROUP_CONCAT(meaning ORDER BY num DESC), ',', 1
            )
        ,   ' ('
        ,   SUBSTRING_INDEX(
                GROUP_CONCAT(num ORDER BY num DESC), ',', 1
            ) / SUM(num) * 100
        ,   '%)'
        ) rank1
,       CONCAT       (
            SUBSTRING_INDEX(
                SUBSTRING_INDEX(
                    GROUP_CONCAT(meaning ORDER BY num DESC), ',', 2
                ), ',', -1
            )
        ,                  ' ('
        ,   SUBSTRING_INDEX     (
                SUBSTRING_INDEX(
                    GROUP_CONCAT        (num ORDER BY num DESC), ',', 2
                ), ',', -1
            ) /         SUM(num) * 100
        ,   '%)'
        ) rank2
,       CONCAT(
            SUBSTRING_INDEX          (
                SUBSTRING_INDEX(
                    GROUP_CONCAT(meaning ORDER BY num DESC), ',', 3
            ), ',', -1)
        ,   ' ('
        ,   SUBSTRING_INDEX(
                SUBSTRING_INDEX(
                    GROUP_CONCAT           (num ORDER BY num DESC), ',', 3
                ), ',', -1
            ) / SUM(num) * 100
        ,   '%)'
        )       rank3
FROM    (
        SELECT      word, meaning, COUNT(*) num
        FROM        t_meaning m
        GROUP BY    word,meaning
        ) a
GROUP BY word


Try to beautify above query using Ctr+B, first time it appends with non-ASCII text, remove that text and give a try.. 5/10 hanged at my end.

Interestingly, memory usage shoot up to ~2G and host machine hanged.
[16 Oct 2014 13:52] Mike Lischke
Bug #74390 marked as duplicate.
[5 Nov 2014 1:56] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.2.4 release, and here's the changelog entry:

On Windows, "Beautify/reformat the SQL script" could cause MySQL Workbench
to freeze.

Thank you for the bug report.
[5 Dec 2014 17:05] jason neumann
I am still experiencing this in 6.2.4. It's happened twice to me for this query:

 SELECT `e`.*, `cat_pro`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_category_product` AS `cat_pro` ON cat_pro.product_id=e.entity_id AND cat_pro.category_id='5'
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '0' AND price_index.customer_group_id = 0
 INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=0 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '5'
[5 Dec 2014 17:09] jason neumann
I'm still experiencing this in 6.2.4 with the following query:
SELECT `e`.*, `cat_pro`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_category_product` AS `cat_pro` ON cat_pro.product_id=e.entity_id AND cat_pro.category_id='5'
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '0' AND price_index.customer_group_id = 0
 INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=0 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '5'
[9 Oct 2015 17:11] Neal Benner
I'm experiencing an issue more closely describing the Bug #74390 that was marked as a duplicate of this. In 6.3.4 I'm working with queries that I move between my IDE and workbench and occasionally when I paste one into workbench it immediately starts to consume all available memory. This occurs on the PASTE action, NOT on any attempt to beautify my query. I wasn't able to find any settings that say to beautify my code automatically. And I am able to run the beautify function on my code without issue.

I am running Version 6.3.4.0 build 828 (64 bit) on Linux Fedora 22