https://bz.apache.org/bugzilla/show_bug.cgi?id=69399

            Bug ID: 69399
           Summary: JspRuntimeLibrary.releaseTag not called anymore when
                    enablePooling=false
           Product: Tomcat 9
           Version: 9.0.96
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: michal.sobkiew...@wp.pl
  Target Milestone: -----

Before fix (?) for bug 69333
(https://github.com/apache/tomcat/commit/4e16d8e30d2215ca9680edfa29feeaef5e26e91f#diff-bfcdd8b656071a9d6eb18bf8414b7daae9d5ab6243adaba16dbcefb808f0487f),
JspRuntimeLibrary.releaseTag was called IFF pooling was disabled (and also when
pooling was enabled but TagHandlerPool saturated to be precise). It was _not_
called when ${tagHandlerVar}._reused was set to true but _was_ called when
polling was disabled. Now it is the exact opposite: it is called when polling
is enabled and not called when it is disabled. Something seems to be wrong.

According to
https://docs.oracle.com/javaee/7/api/javax/servlet/jsp/tagext/Tag.html:
"The page compiler guarantees that release() will be invoked on the Tag handler
before the handler is released to the GC."

Maybe this fix was supposed to produce something like

if (usePooling(n)) {
    // Print tag reuse
    out.printin(n.getTagHandlerPoolName());
    out.print(".reuse(");
    out.print(tagHandlerVar);
    out.println(");");
} else {
    // Clean-up
    out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
    out.print(tagHandlerVar);
    out.println(", _jsp_getInstanceManager());");
}

instead of

if (usePooling(n)) {
    // Print tag reuse
    out.printin(n.getTagHandlerPoolName());
    out.print(".reuse(");
    out.print(tagHandlerVar);
    out.println(");");

    // Clean-up
    out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(");
    out.print(tagHandlerVar);
    out.println(", _jsp_getInstanceManager());");
}

?

We've encountered this because some of the tags we use do setup some state in
constructor and clean that up in release(). Tag reuse is then obviously
impossible, as it's state is irreversibly broken.

Please let me know if I can help (including PR).

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to