https://bz.apache.org/bugzilla/show_bug.cgi?id=68634
Bug ID: 68634 Summary: Forwards using custom response classes do not wait for session replication Product: Tomcat 9 Version: 9.0.85 Hardware: Other OS: Linux Status: NEW Severity: normal Priority: P2 Component: Cluster Assignee: dev@tomcat.apache.org Reporter: atsushi.okuy...@ip3.co.jp Target Milestone: ----- Created attachment 39590 --> https://bz.apache.org/bugzilla/attachment.cgi?id=39590&action=edit An app for reproducing. I have set up a Tomcat cluster using SimpleTcpCluster with channelSendOptions = "6". (Tomcat version: 9.0.71, 9.0.85) Channel.SEND_OPTIONS_SYNCHRONIZED_ACK = 0x0004 Channel.SEND_OPTIONS_USE_ACK = 0x0002 In my understanding, the http response will not complete until session replication is complete with channelSendOptions="6". However, the response completes just before session sharing completes using a custom response class. I think the ApplicationDispatcher.doForward method has some issue. If the response is not an instance of ResponseFacade, the response writer is closed before session replication starts. The following is the procedure for reproducing this issue. The attached WAR is an app for reproducing. ------------------------------------- (open ports: 4000, 8005, 8080, 14000, 18005, 18080) (1) Download and create two copies of Apache Tomcat. $ curl -O https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.85/bin/apache-tomcat-9.0.85.tar.gz $ tar -zxf apache-tomcat-9.0.85.tar.gz $ mv apache-tomcat-9.0.85 apache-tomcat-9.0.85_1 $ cp -rp apache-tomcat-9.0.85_1 apache-tomcat-9.0.85_2 (2) Configure clustering. $ cp -p server_1.xml apache-tomcat-9.0.85_1/conf/server.xml $ cp -p server_2.xml apache-tomcat-9.0.85_2/conf/server.xml (3) Deploy the application for reproduction. $ cp -p reprod.war apache-tomcat-9.0.85_1/webapps/ $ cp -p reprod.war apache-tomcat-9.0.85_2/webapps/ (4) Start Apache Tomcats. One as normal and one as debug. $ ./apache-tomcat-9.0.85_2/bin/startup.sh $ JPDA_ADDRESS=0.0.0.0:8000 ./apache-tomcat-9.0.85_1/bin/catalina.sh jpda run & (5) Attach the debugger and set a breakpoint. Set a breakpoint in the method that replicates the session. $ jdb -attach 127.0.0.1:8000 > stop in > org.apache.catalina.ha.session.DeltaManager.requestCompleted(java.lang.String, > boolean) (6) Open another terminal and visit the URL for the expected behavior. $ curl http://127.0.0.1:8080/reprod/servlets/expected The breakpoint has been hit and the curl command is waiting for the response to complete. So run the "cont" command in the debugger to continue the process. http-nio-8080-exec-2[1] cont The curl command then exits. (7) Visit the URL that behaves unexpectedly. $ curl http://127.0.0.1:8080/reprod/servlets/reprod The debugger stops the thread at the breakpoint, but the curl command exits immediately. (8) Stop debugger and tomcats. > Ctrl-D $ fg Ctrl-C $ ./apache-tomcat-9.0.85_2/bin/shutdown.sh -- 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