The session ID created in clustered instances of earlier JBoss EAP versions contained a full source in a deployed bean's metadata (used to create a session ID). This was causing beans deployed across different nodes in the cluster to be recreated if a session ID was reused when accessing a different node. A NullPointerException could also been seen in the later node's log.
New code has been introduced that obtains a relative path, rather than an absolute path. This means that beans are no longer recreated and the NPE no longer presents.
Created attachment 822497 [details]
File contains reproducer, NPE and standalone-ha.xml
Description of problem:
On a JSF page which contains: session creation date, bean1 Timestamp property and bean2 Timestamp property.
When accessing node1, a session is created and the JSF is loaded showing the timestamp for the 3 properties.
When trying to access node2 using the same session ID, via index.xhtml;jsessionid=...sessionid... node2 JSF will show the same session ID and timestamp as node1, but the bean1 and bean2 Timestamps are new, meaning both beans were recreated.
We can see on node2 logs that it threw JBAS010322 and a NPE.
This was tested using multicast and unicast.
Version-Release number of selected component (if applicable):
Please see attached file.
Steps to Reproduce:
1. Configure an EAP cluster
2. Build and deploy the code on the attached file
3. Access one of the nodes, http://node1-ip:8080/demo-war/index.xhtml
4. Copy the session ID
5. On the second node try http://node2-ip:8080/demo-war/index.xhtml;jsessionid=<sessionid-from-node1>
bean1 and bean2 timestamps are different between nodes
bean1 and bean2 timestamps should be the same
The NPE is thrown after a serialized proxy is unable to attach back to the Bean<?> instance on deserialization. It seems that no Bean<?> with the matching id is found on the other node.
Bean ID creation is deterministic and both nodes should contain the same set of beans and IDs.
The only scenario in which this could possibly happen is when the an application on one node is different to the other one. This could include a small difference such as a filename.
Unfortunately Weld currently does not provide any debug information on such failure.
I got this reply from the customer:
> we had a closer look at the id:
> 18:37:48,303 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]] (http-/127.0.0.1:8180-1) JBWEB000233: Exception sending request initialized lifecycle event to listener instance of class org.jboss.weld.servlet.WeldListener: java.lang.IllegalStateException: Error restoring serialized contextual with id org.jboss.weld.bean-demo-ear.ear.demo-war.war/home/pete/jboss-eap-6.1-orig-1/standalone/deployments/demo-ear.ear/demo-war.war/WEB-INF/classes-ManagedBean-class demo.war.DemoSessionBean
> It seems likt the id contains the complete path, in our example:
> so we deployed it on two hosts, and switched from:
> on both hosts. And it worked!
It seems the contextual ID is taking the full path into consideration.
resourceRoot.getRoot().getPathName() apparently returns an absolute path /home/pete/jboss-eap-6.1-orig-1/standalone/deployments/demo-ear.ear/demo-war.war instead of the relative one such as /content/demo-ear.ear/demo-war.war
This happens for exploded deployments
The upstream fix should deal with this as well.
eap 6.2.0 patch ready at https://bugzilla.redhat.com/show_bug.cgi?id=1040671
Added draft release note text in the Docs Text field above.
Verified on 6.3.0.DR0.