exceptions with http session replication in a cluster or ha config
georges.goebel Oct 29, 2014 3:44 AMHi,
We setup a new wildfly cluster with two nodes in a domain config with nodes running in full-ha profile. The applications deploy correctly but some applications produce errors when performing a logout (session.invalidate()). We tested the same war on wildfly 8.1 final and windfly 9.0.0 Alpha1 which produced differed errors. So I guess the problem is somehow in the infinispan config or implementation. For testing this small application we started a fresh copy of wildfly with standalone-ha.xml and no changes (no need of any datasource or external library)
We created a small war with only 2 beans to reproduce the behaviour with no external dependencies.
The login bean is a simple sessionscoped been which handes the login and logout with the session invalidation (-> doLogout() throws the exception)
@Named
@SessionScoped
public class LoginBean implements Serializable {
private Date loginDate;
@PostConstruct
public void postConstruct() {
System.out.println("LoginBean.postConstruct... (" + this + ")");
loginDate = new Date();
}
@PreDestroy
public void preDestroy() {
System.out.println("LoginBean.preDestroy... (" + this + ")");
}
public Date getLoginDate() {
return loginDate;
}
public void setLoginDate(Date loginDate) {
this.loginDate = loginDate;
}
public String doLogout() {
System.out.println("doLogout...");
FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
System.out.println("doLogout.DONE");
return "step1?faces-redirect=true";
}
}
The conversationscoped bean does only increment a counter
@Named
@ConversationScoped
public class ConversationBean implements Serializable {
private static final long serialVersionUID = 4771270804699990999L;
@Inject
private Conversation conversation;
private int counter;
@PostConstruct
public void postConstruct() {
System.out.println("ConvBean.postConstruct... (" + this + ")");
counter = 0;
}
@PreDestroy
public void preDestroy() {
System.out.println("ConvBean.preDestroy... (" + this + ")");
}
public void startConversation() {
if (conversation.isTransient()) {
conversation.begin();
}
}
public String endConversation() {
System.out.println("ConvBean.endConversation...");
if (!conversation.isTransient()) {
System.out.println("ConvBean.endConversation.END!!!");
conversation.end();
}
return "step1?faces-redirect=true";
}
public void increment() {
counter++;
}
public void decrement() {
counter--;
}
public String gotoStep2() {
return "step2?faces-redirect=true";
}
public String gotoStep3() {
return "step3?faces-redirect=true";
}
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
public Conversation getConversation() {
return conversation;
}
}
As previously mentioned the doLogout method produces an exception which is different on wildfly 8.1 than on wildfly 9 Alpha
wildfly 8.1
08:36:08,263 DEBUG [org.infinispan.util.concurrent.locks.LockManagerImpl] (default task-17) Failed to acquire lock org.wildfly.clustering.server.group.AddressableNode@afb0b6a2, owner is GlobalTransaction:<nodeA/web>:16:local
08:36:08,264 DEBUG [org.infinispan.util.concurrent.locks.LockManagerImpl] (default task-17) This transaction (GlobalTransaction:<nodeA/web>:17:local) already owned locks []
08:36:08,266 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (default task-17) ISPN000136: Execution error: org.infinispan.util.concurrent.TimeoutException: Unable to acquire lock after [15 seconds] on key [org.wildfly.clustering.server.group.AddressableNode@afb0b6a2] for requestor [GlobalTransaction:<nodeA/web>:17:local]! Lock held by [GlobalTransaction:<nodeA/web>:16:local]
at org.infinispan.util.concurrent.locks.LockManagerImpl.lock(LockManagerImpl.java:198)
at org.infinispan.util.concurrent.locks.LockManagerImpl.acquireLock(LockManagerImpl.java:171)
at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.lockKeyAndCheckOwnership(AbstractTxLockingInterceptor.java:169)
at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitPutKeyValueCommand(PessimisticLockingInterceptor.java:107)
at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(PutKeyValueCommand.java:70)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112)
at org.infinispan.commands.AbstractVisitor.visitPutKeyValueCommand(AbstractVisitor.java:32)
In Wildfly 9.0 Alpha we have a different exception :
08:41:24,082 DEBUG [org.jboss.weld.Conversation] (default task-7) WELD-000318: Returned long-running conversation 1 to transient
08:41:24,082 INFO [stdout] (default task-7) ConvBean.preDestroy... (lu.etat.pch.convTest.ConversationBean@14c3d150)
08:41:24,085 INFO [stdout] (default task-7) doLogout.DONE
08:41:24,087 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (default task-7) ISPN000136: Execution error: java.lang.IllegalStateException: Transaction DummyTransaction{xid=DummyXid{id=13}, status=3} is not in a valid state to be invoking cache operations on.
at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:275)
at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:240)
at org.infinispan.interceptors.TxInterceptor.visitReplaceCommand(TxInterceptor.java:201)
at org.infinispan.commands.write.ReplaceCommand.acceptVisitor(ReplaceCommand.java:55)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:112)
at org.infinispan.commands.AbstractVisitor.visitReplaceCommand(AbstractVisitor.java:42)
at org.infinispan.commands.write.ReplaceCommand.acceptVisitor(ReplaceCommand.java:55)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at org.infinispan.statetransfer.StateTransferInterceptor.handleNonTxWriteCommand(StateTransferInterceptor.java:206)
at org.infinispan.statetransfer.StateTransferInterceptor.visitReplaceCommand(StateTransferInterceptor.java:161)
at org.infinispan.commands.write.ReplaceCommand.acceptVisitor(ReplaceCommand.java:55)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:98)
at org.infinispan.interceptors.CacheMgmtInterceptor.updateStoreStatistics(CacheMgmtInterceptor.java:148)
at org.infinispan.interceptors.CacheMgmtInterceptor.visitReplaceCommand(CacheMgmtInterceptor.java:139)
Any hint or help is welcome to solve the issue
-
convTest.zip 23.8 KB
-
convTest.war 7.2 KB