Mantis - Resin
Viewing Issue Advanced Details
5943 minor always 08-31-15 06:59 03-13-17 14:56
stbu  
 
normal  
closed 4.0.44  
fixed  
none    
none 4.0.52  
0005943: Dupliate Access-Log Entries when using host-level Redirect Rule with an IfMBeanEnabled condition
I've had the following configuration in my Resin-Pro 4.0.44 resin.xml:

    <!-- the default host, matching any host name -->
    <host id="" root-directory=".">
      <!--
         - webapps can be overridden/extended in the resin.xml
        -->
      <web-app id="/" root-directory="webapps/ROOT"/>

! <resin:Redirect regexp="^/(dupl-access-log|other-apps|with-db-access)/(.*)$" target="/maintenance.jsp">
! <resin:IfMBeanEnabled name="FailureRewrite" enabled="false"/>
! </resin:Redirect>
!
! <web-app id="/dupl-access-log" root-directory="webapps/test"/>

    </host>

Lines starting with "!" have been added. This configuration allows to redirect requests to a maintenance page whenever the FailureRewrite was enabled via JMX - initially this rule is not enabled.

However this is causing that any requests to web-app /dupl-access-log is causing duplicate entries in the access.log file. For example:

[::1] - - [31/Aug/2015:15:35:11 +0200] "GET /dupl-access-log/ HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
[::1] - - [31/Aug/2015:15:35:11 +0200] "GET /dupl-access-log/ HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
[::1] - - [31/Aug/2015:15:35:27 +0200] "GET /dupl-access-log/test123.txt HTTP/1.1" 404 211 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
[::1] - - [31/Aug/2015:15:35:27 +0200] "GET /dupl-access-log/test123.txt HTTP/1.1" 404 211 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
[::1] - - [31/Aug/2015:15:37:56 +0200] "GET /dupl-access-log/sample-error.jsp HTTP/1.1" 500 4316 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
[::1] - - [31/Aug/2015:15:37:56 +0200] "GET /dupl-access-log/sample-error.jsp HTTP/1.1" 500 4316 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"

In the Stack Trace of an exception (see "Additional Information" in this bug-report) you can recognize that AccessLogFilterChain.doFilter appears twice.

Expected result:
Just one entry in access.log for every request.

Caused by: java.lang.IllegalStateException: Demonstration Error
    at _jsp._sample_22derror__jsp._jspService(sample-error.jsp:7)
    at _jsp._sample_22derror__jsp._jspService(sample-error.jsp:3)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:64)
    at com.caucho.jsp.Page.pageservice(Page.java:548)
    at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:194)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
>>> at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.rewrite.MatchFilterChain.doFilter(MatchFilterChain.java:98)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
>>> at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1349)
    at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1305)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1289)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1197)
    at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:993)
    at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)
    at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
    at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
    at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)
    at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
    at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)

Notes
(0006741)
ferg   
03-13-17 14:56   
server/02ex, server/02ey