ZenFoundation's include-section macro crashes JVM when used with unexisting page
Asked by Gregory Joseph:

The following makes our JVM crash with no specific log messages

```
&lt;ac:macro ac:name="include-section"&gt;      &lt;ac:parameter ac:name="page"&gt;Some unexisting page&lt;/ac:parameter&gt;    &lt;/ac:macro&gt;
```

It is possible to reproduce this using the macro browser tool, too. We started seeing this after deleting a page used in this macro. As it stands, I can't even be sure if that's the only macro showing this behavior.

Is there anything I can do, other than disable the macro ? Have others seen the same problem ? Do I have any other choice than try all macros for possibly similar behavior ?

java version "1.6.0_32"

Java(TM) SE Runtime Environment (build 1.6.0_32-b05)

Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)


Answers:
author: Darryl Duke
body: Yikes! Thanks for posting this, Gregory. We're on it, and will have this fixed for Zen 5.2.9.

comments: author: Darryl Duke
body: Update: we have found and fixed the problem.

We will review all Zen macros to make sure this isn't a problem anywhere else, and will post anything else we find.


author: Gregory Joseph
body: Thanks for the quick reaction. I'm curious what this stack overflow in CharsetDecoder could be.

Any ETA for 5.2.9 yet ?


author: Darryl Duke
body: No hard date set, but we're aiming for the next 3-4 weeks.


author: Gregory Joseph
body: After updating to 1.6.0_45, the JVM stopped crashing, and we now see this, which confirms my suspicion that this was similar to CONF-15247:

```
2013-04-26 18:09:26,407 ERROR [http-8090-6] [confluence.util.velocity.VelocityUtils] getRenderedTemplate Error occurred rendering template: zen/templates/include-section.vm -- referer: http://wiki.magnolia-cms.com/display/SANDBOX/Home | url: /display/SANDBOX/test2 | userName: gjoseph | action: viewpage | page: 64520194org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getIncludedContent' in  class com.zenfoundation.macros.IncludeSectionMacro threw exception java.lang.StackOverflowError at theme/html/macros/include-section.html[line 2, column 42]	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:237)[...]Caused by: java.lang.StackOverflowError	at java.nio.charset.CharsetDecoder.&lt;init&gt;(CharsetDecoder.java:169)	at java.nio.charset.CharsetDecoder.&lt;init&gt;(CharsetDecoder.java:209)	at sun.nio.cs.US_ASCII$Decoder.&lt;init&gt;(US_ASCII.java:49)	at sun.nio.cs.US_ASCII$Decoder.&lt;init&gt;(US_ASCII.java:46)	at sun.nio.cs.US_ASCII.newDecoder(US_ASCII.java:39)	at java.lang.StringCoding$StringDecoder.&lt;init&gt;(StringCoding.java:116)
```

which is then followed by

```
2013-04-26 18:09:26,629 ERROR [http-8090-6] [sf.hibernate.collection.PersistentCollection] initialize Failed to lazily initialize a collection -- referer: http://wiki.magnolia-cms.com/display/SANDBOX/Home | url: /display/SANDBOX/test2 | userName: gjoseph | action: viewpage | page: 64520194net.sf.hibernate.HibernateException: collection was evicted	at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3307)
```

etc.

I'd attach the full stacktrace if I could; I'll be happy to email it to anyone who could help fixing this.


Tags: addon-com.zenfoundation

confluence-administration