-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
10.0.0
-
None
-
Security Level: Jimmy
Steps to Reproduce
- enable WebSocket
- click any button on the page
- run with Tomcat 9.0.95
<listener> <listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class> </listener>
Current Result
[INFO] 2024-11-01 17:39:36 [ERROR] Encodes:401 -
[INFO] java.lang.IllegalStateException: The request object has been recycled and is no longer associated with this facade
[INFO] at org.apache.catalina.connector.RequestFacade.checkFacade(RequestFacade.java:856)
[INFO] at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:245)
[INFO] at javax.servlet.ServletRequestWrapper.getAttribute(ServletRequestWrapper.java:83)
[INFO] at org.zkoss.zkmax.ui.http.FacadeHttpServletRequest.getAttribute(FacadeHttpServletRequest.java:276)
[INFO] at javax.servlet.ServletRequestWrapper.getAttribute(ServletRequestWrapper.java:83)
[INFO] at org.zkoss.zkmax.au.websocket.RequestWrapper.getAttribute(RequestWrapper.java:70)
[INFO] at org.zkoss.web.servlet.http.Https.getThisContextPath(Https.java:154)
[INFO] at org.zkoss.web.util.resource.ClassWebResource$CWC.encodeURL(ClassWebResource.java:810)
[INFO] at org.zkoss.web.servlet.http.Encodes.encodeURL0(Encodes.java:456)
[INFO] at org.zkoss.web.servlet.http.Encodes.access$000(Encodes.java:48)
[INFO] at org.zkoss.web.servlet.http.Encodes$1.encodeURL(Encodes.java:426)
[INFO] at org.zkoss.web.servlet.http.Encodes.encodeURL(Encodes.java:399)
[INFO] at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:321)
[INFO] at org.zkoss.zul.A.getEncodedHref(A.java:175)
[INFO] at org.zkoss.zul.A.renderProperties(A.java:190)
[INFO] at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2181)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.redraw(UiVisualizer.java:1003)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.redrawComponents(UiVisualizer.java:1017)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.addResponsesForCreatedPerSiblings(UiVisualizer.java:869)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.getResponses(UiVisualizer.java:733)
[INFO] at org.zkoss.zk.ui.impl.UiEngineImpl.getResponses(UiEngineImpl.java:1569)
[INFO] at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1339)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.process(WebSocketEndPoint.java:379)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.access$500(WebSocketEndPoint.java:74)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint$1.onMessage(WebSocketEndPoint.java:172)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint$1.onMessage(WebSocketEndPoint.java:153)
[INFO] at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:390)
...
[INFO] 2024-11-01 17:39:37 [ERROR] UiEngineImpl:1576 -
[INFO] org.zkoss.zk.ui.UiException: javax.servlet.ServletException: Unable to encode ~./apage.zul
[INFO] at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:332)
[INFO] at org.zkoss.zul.A.getEncodedHref(A.java:175)
[INFO] at org.zkoss.zul.A.renderProperties(A.java:190)
[INFO] at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2181)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.redraw(UiVisualizer.java:1003)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.redrawComponents(UiVisualizer.java:1017)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.addResponsesForCreatedPerSiblings(UiVisualizer.java:869)
[INFO] at org.zkoss.zk.ui.impl.UiVisualizer.getResponses(UiVisualizer.java:733)
[INFO] at org.zkoss.zk.ui.impl.UiEngineImpl.getResponses(UiEngineImpl.java:1569)
[INFO] at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1339)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.process(WebSocketEndPoint.java:379)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.access$500(WebSocketEndPoint.java:74)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint$1.onMessage(WebSocketEndPoint.java:172)
[INFO] at org.zkoss.zkmax.au.websocket.WebSocketEndPoint$1.onMessage(WebSocketEndPoint.java:153)
[INFO] at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:390)
...
[INFO] Caused by: javax.servlet.ServletException: Unable to encode ~./apage.zul
[INFO] at org.zkoss.web.servlet.http.Encodes.encodeURL(Encodes.java:402)
[INFO] at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:321)
[INFO] ... 31 more
[INFO] Caused by: java.lang.IllegalStateException: The request object has been recycled and is no longer associated with this facade
[INFO] at org.apache.catalina.connector.RequestFacade.checkFacade(RequestFacade.java:856)
[INFO] at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:245)
[INFO] at javax.servlet.ServletRequestWrapper.getAttribute(ServletRequestWrapper.java:83)
[INFO] at org.zkoss.zkmax.ui.http.FacadeHttpServletRequest.getAttribute(FacadeHttpServletRequest.java:276)
[INFO] at javax.servlet.ServletRequestWrapper.getAttribute(ServletRequestWrapper.java:83)
[INFO] at org.zkoss.zkmax.au.websocket.RequestWrapper.getAttribute(RequestWrapper.java:70)
[INFO] at org.zkoss.web.servlet.http.Https.getThisContextPath(Https.java:154)
[INFO] at org.zkoss.web.util.resource.ClassWebResource$CWC.encodeURL(ClassWebResource.java:810)
[INFO] at org.zkoss.web.servlet.http.Encodes.encodeURL0(Encodes.java:456)
[INFO] at org.zkoss.web.servlet.http.Encodes.access$000(Encodes.java:48)
[INFO] at org.zkoss.web.servlet.http.Encodes$1.encodeURL(Encodes.java:426)
[INFO] at org.zkoss.web.servlet.http.Encodes.encodeURL(Encodes.java:399)
[INFO] ... 32 more
Expected Result
no error
Debug Information
- since Tomcat 9.0.90, discardFacades = true by default
- see https://tomcat.apache.org/tomcat-9.0-doc/config/http.html
discardFacades
A boolean value which can be used to enable or disable the recycling of the facade objects that isolate the container internal request processing objects. If set to true the facades will be set for garbage collection after every request, otherwise they will be reused. This setting has no effect when the security manager is enabled. If not specified, this attribute is set to the value of the org.apache.catalina.connector.RECYCLE_FACADES system property, or true if not set. - can be reproduced by cargo maven plugin
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven3-plugin</artifactId> <version>1.10.15</version> <configuration> <container> <containerId>tomcat9x</containerId> </container> </configuration> </plugin>
build a WAR file.
run mvn cargo:run
Workaround
discardFacades = false