Bug #53047 StackOverflow while opening QUAN details for deep nested query (more 8 levels)
Submitted: 22 Apr 2010 8:26
Reporter: Andrii Nikitin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Server Severity:S3 (Non-critical)
Version:2.1, 2.2.0.1693 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Triage: Needs Triage: D4 (Minor)

[22 Apr 2010 8:26] Andrii Nikitin
Description:
Following Exception shown when clicking on deep nested query in QUAN page in dashboard.

"
An Error Occurred

    * java.lang.reflect.InvocationTargetException sun.reflect.GeneratedMethodAccessor214.invoke(Unknown Source)
"

If email notifications enabled, stacktrace starting with following is sent (see attached file):

java.lang.StackOverflowError
at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1033)
at org.antlr.stringtemplate.StringTemplate.getAttributeRenderer(StringTemplate.java:1045)
...

How to repeat:
1. setup query analyzer
2. run following SQL:

set group_concat_max_len = 1024*1024;

select concat(
  group_concat("select 1 from (" separator ""), 
  "select 1", 
  repeat(") a", count(*)), ";") as deep_nested_query 
from (select 1 from mysql.help_topic limit 8) a 
into outfile "/tmp/n8.sql";

source /tmp/n8.sql

select concat(
  group_concat("select 1 from (" separator ""), 
  "select 1", 
  repeat(") a", count(*)), ";") as deep_nested_query 
from (select 1 from mysql.help_topic limit 9) a 
into outfile "/tmp/n9.sql";

source /tmp/n9.sql

3. Open query analyzer, click on later query and observe "An Error Occurred" from Description.

Suggested fix:
avoid error message: show of truncate query in QUAN details
[22 Apr 2010 8:27] Andrii Nikitin
formatter stackoverflow with stacktrace

Attachment: stacktrace.log (application/octet-stream, text), 54.95 KiB.

[22 Apr 2010 8:37] Andrii Nikitin
> cat n9.sql
select 1 from (select 1 from (select 1 from (select 1 from (select 1 from (select 1 from (select 1 from (select 1 from (select 1 from (select 1) a) a) a) a) a) a) a) a) a;