4

We have used the RSTL tags in our project as explained below with the latest code available on the web: http://yatb.mitza.net/2013/07/rel-standard-tag-library.html

I am noticing a strange error that the expressions are working fine & we get the JSP output as expected but a couple of times the design of the pages gets distorted. When I analyzed the issue I found that we have a conditional which gets closed on meeting an expression as below:

<c:if test="iSectionColumn gt icolumnCount">
   <c:set var="rowCount" value="0" />
   <c:set var="columnCount" value="${columnCount + 1}" />
     @("</div>")
</c:if>

Sometimes when iSectionColumn is equals to icolumnCount, the inner code gets executed and break the layout. To avoid any double/float/Integer issues, I also tried converting both the variables to Integer before comparison, still, sometimes the code gets executed which I am not able to figure out that why is it happening.

As this issue is intermittent, I wrote a script to access the same page in different threads and found that out of 1000 threads 6 or 7 usually gives the different html output where the code inside the expression got executed.

Any pointers to debug the issue would be a great help.

Thanks in advance

5
  • 1
    I think you have discovered a bug. Indeed by looking at the RSTL code, there seems to be a race condition where the wrong variable value might be used in multi-threaded situation. I believe a quick fix is to disable expression caching in class net.mitza.rel.parser.Parser. Set USE_CACHE to false (requires recompilation). I'll need to investigate further to provide a proper fix Sep 5, 2017 at 13:27
  • Thanks, Mihai, I tried that but unfortunately, still, that expression is being executed. I have noticed, an error coming very often in logs though the expression error has nothing to do with this (I guess) wondering when can this happen which also comes in multi threaded requests Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: parser.expression.EvaluationException: Context has not been set while evaluating url. Use the SetContextVisitor on the top-level expression. at rel.base.ExpressionEvaluator.evaluate(ExpressionEvaluator.java
    – Yash
    Sep 5, 2017 at 14:33
  • That error shows up if indeed no context has been set. This can also happen because of the threading issue. Are you sure you see this when USE_CACHE is set to false? Without cache, the parser would build an expression tree for every single invocation, thus no more threading issues on the same object Sep 5, 2017 at 14:38
  • Yes, I have set USE_CACHE = false and the rendering is still failing at the same compare expression. Could you please let me know where else can we make the changes and I will give it a try. Thanks
    – Yash
    Sep 6, 2017 at 16:03
  • I don't have a solution from the top of my head. This would require effort to reproduce, understand, fix... Jun 17, 2019 at 4:49

1 Answer 1

0

was wondering if you could respond to this post .. RSTL with Web 8.5

Yash ... Was wondering if there is any good SDL documentation around JSP support for content delivery ? Also curious how you have RSTL configured with JSP ? SDL docs seem rather vague ..

https://docs.sdl.com/LiveContent/content/en-US/SDL%20Web-v5#url=/LiveContent/web/search.xql%3Fc%3Dt%26pub%3DSDL+Web-v5%26lang%3Den-US%26action%3Dsearch%26query%3Djsp&sid=lcSearch.runSearch1547663196452&currentQuery=jsp&currentScope=&eventType=lcContent.loadDocGUID-1A8ECDE5-6EEA-45D9-88BC-02276DCDA1D8&query=&scope=&filename=GUID-301953B3-586D-440B-8E0F-737C4526787B.xml&docid=GUID-1A8ECDE5-6EEA-45D9-88BC-02276DCDA1D8&inner_id=&tid=&addHistory=true&resource=&toc=false

2
  • This is really not an answer, is it? Maybe comment on Mihai’s blog is a better way to contact him.
    – Nuno Linhares
    Jan 17, 2019 at 12:16
  • This has been 6 years ago. I definitely don't remember how I set it up. But at its base RSTL is nothing more than a collection of Java custom tags that are configured with JSPs in a normal way. The parser and expression evaluators on the other hand are all custom. This is where the tricky parts lie. Jun 17, 2019 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.