Is there a limitation on the number of values the replace and render macro can hold?

We are getting an error "Error formatting macro: run: java.lang.StackOverflowError" when using the replace and render macro. It works on preview until we select the top 785 but fails with the above error when we save the page. It work both on preview and page save when we only select top 100 or nay lower numbers.

{replace-and-render}
{replace-item:%componentsel%}{sql:dataSource=DS|output=html|heading=false|border=0|table=false}
 select top 1000':''',ccc,''':''',ccc,'''' from (
   select distinct component as ccc from releases where 
   date>dateadd([year],-1,GETDATE())
union 
   select distinct component as ccc from installs where  expdate >= getdate() 
)  as c  order by ccc asc
{sql}{replace-item}
{replace-body}
{run:autorun=true|replace=component:sysadmin:Select component:select:%componentsel%}


{run}
{replace-body}
{replace-and-render}

1 answer

1 accepted

I've got the answer from the developer Bob as follows:

1. Stack overflow errors can occur when using regex patterns that are large or complex. Sometimes this is due to error but in some cases it just requires more stack space.

2. Try increasing your stack space and see if that allows a higher #. If so, keep increasing until it covers your case. For instance, I have used -Xss4096k on a Confluence instance with more complex cases.

So I've increased our stack space on is-testconfluence to -Xss40966k and your script now works fine

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

268 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you