You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Martin Koci <ma...@aura.cz> on 2010/08/14 17:20:19 UTC

WebBeansPhaseListener doesn't release ConversationContext for long running conversation

Hi,

this use case probably leads to odd behaviour of conversation:

1) in first JSF request/response, in invoke application, I start long
running conversation with conversation.begin()

2) WebBeansPhaseListener.afterPhase(PhaseEvent) does some operation with
conversation object, but does not it **release** from ThreadLocal

3) then I create a GET request to other view in the same application but
without any operation with conversation,
WebBeansPhaseListener.afterPhase calls
ContextFactory.destroyConversationContext(); and destroys same instance
of ConversationContext because it is still in ThreadLocal!


I think WebBeansPhaseListener.afterPhase should contains something like
this:

else
{
 //Conversation must be used by one thread at a time
 ConversationImpl owbConversation = (ConversationImpl)conversation;
owbConversation.updateTimeOut();
//Other threads can now access propogated conversation.
owbConversation.setInUsed(false);                

ContextFactory.releaseButNOTDestroyConversationContext();

}            


What do you think?


Regards,

Martin Kočí





Re: WebBeansPhaseListener doesn't release ConversationContext for long running conversation

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Good news that you have no problem. 


>>>OWB is WrappedValueExression with ~100 000 instances
Means, you have ~100.000 core JSF ValueExpression :)


Thanks;

--Gurkan


________________________________
From: Martin Koci <ma...@aura.cz>
To: dev@openwebbeans.apache.org
Sent: Sat, August 14, 2010 7:09:03 PM
Subject: Re: WebBeansPhaseListener doesn't release ConversationContext for long 
running conversation

Yes, 

that solves my problem. Btw. I'm looking on results from stress tests
right now  and after 6 hous of running the most frequented object from
OWB is WrappedValueExression with ~100 000 instances but it is no
problem, it's expeceted result due to big jsf views.

Regards,

Martin Kočí

Gurkan Erdogdu píše v So 14. 08. 2010 v 08:42 -0700:
> Good catch Martin,
> 
> I think it is enough to put following into WebContextService, WDYT?
> 
> private void destroyRequestContext(ServletRequestEvent request)
> {
>           .......
> 
>      conversationContext.set(null);
>      conversationContext.remove();
> }
> 
> 
> 
> 
> ________________________________
> From: Martin Koci <ma...@aura.cz>
> To: dev@openwebbeans.apache.org
> Sent: Sat, August 14, 2010 6:20:19 PM
> Subject: WebBeansPhaseListener doesn't release ConversationContext for long 
> running conversation
> 
> Hi,
> 
> this use case probably leads to odd behaviour of conversation:
> 
> 1) in first JSF request/response, in invoke application, I start long
> running conversation with conversation.begin()
> 
> 2) WebBeansPhaseListener.afterPhase(PhaseEvent) does some operation with
> conversation object, but does not it **release** from ThreadLocal
> 
> 3) then I create a GET request to other view in the same application but
> without any operation with conversation,
> WebBeansPhaseListener.afterPhase calls
> ContextFactory.destroyConversationContext(); and destroys same instance
> of ConversationContext because it is still in ThreadLocal!
> 
> 
> I think WebBeansPhaseListener.afterPhase should contains something like
> this:
> 
> else
> {
> //Conversation must be used by one thread at a time
> ConversationImpl owbConversation = (ConversationImpl)conversation;
> owbConversation.updateTimeOut();
> //Other threads can now access propogated conversation.
> owbConversation.setInUsed(false);                
> 
> ContextFactory.releaseButNOTDestroyConversationContext();
> 
> }            
> 
> 
> What do you think?
> 
> 
> Regards,
> 
> Martin Kočí
> 


Re: WebBeansPhaseListener doesn't release ConversationContext for long running conversation

Posted by Martin Koci <ma...@aura.cz>.
Yes, 

that solves my problem. Btw. I'm looking on results from stress tests
right now  and after 6 hous of running the most frequented object from
OWB is WrappedValueExression with ~100 000 instances but it is no
problem, it's expeceted result due to big jsf views.

Regards,

Martin Kočí

Gurkan Erdogdu píše v So 14. 08. 2010 v 08:42 -0700:
> Good catch Martin,
> 
> I think it is enough to put following into WebContextService, WDYT?
> 
> private void destroyRequestContext(ServletRequestEvent request)
> {
>           .......
> 
>      conversationContext.set(null);
>      conversationContext.remove();
> }
> 
> 
> 
> 
> ________________________________
> From: Martin Koci <ma...@aura.cz>
> To: dev@openwebbeans.apache.org
> Sent: Sat, August 14, 2010 6:20:19 PM
> Subject: WebBeansPhaseListener doesn't release ConversationContext for long 
> running conversation
> 
> Hi,
> 
> this use case probably leads to odd behaviour of conversation:
> 
> 1) in first JSF request/response, in invoke application, I start long
> running conversation with conversation.begin()
> 
> 2) WebBeansPhaseListener.afterPhase(PhaseEvent) does some operation with
> conversation object, but does not it **release** from ThreadLocal
> 
> 3) then I create a GET request to other view in the same application but
> without any operation with conversation,
> WebBeansPhaseListener.afterPhase calls
> ContextFactory.destroyConversationContext(); and destroys same instance
> of ConversationContext because it is still in ThreadLocal!
> 
> 
> I think WebBeansPhaseListener.afterPhase should contains something like
> this:
> 
> else
> {
> //Conversation must be used by one thread at a time
> ConversationImpl owbConversation = (ConversationImpl)conversation;
> owbConversation.updateTimeOut();
> //Other threads can now access propogated conversation.
> owbConversation.setInUsed(false);                
> 
> ContextFactory.releaseButNOTDestroyConversationContext();
> 
> }            
> 
> 
> What do you think?
> 
> 
> Regards,
> 
> Martin Kočí
> 



Re: WebBeansPhaseListener doesn't release ConversationContext for long running conversation

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Committed.


________________________________
From: Gurkan Erdogdu <gu...@yahoo.com>
To: dev@openwebbeans.apache.org
Sent: Sat, August 14, 2010 6:42:40 PM
Subject: Re: WebBeansPhaseListener doesn't release ConversationContext for long 
running conversation

Good catch Martin,

I think it is enough to put following into WebContextService, WDYT?

private void destroyRequestContext(ServletRequestEvent request)
{
          .......

     conversationContext.set(null);
     conversationContext.remove();
}




________________________________
From: Martin Koci <ma...@aura.cz>
To: dev@openwebbeans.apache.org
Sent: Sat, August 14, 2010 6:20:19 PM
Subject: WebBeansPhaseListener doesn't release ConversationContext for long 
running conversation

Hi,

this use case probably leads to odd behaviour of conversation:

1) in first JSF request/response, in invoke application, I start long
running conversation with conversation.begin()

2) WebBeansPhaseListener.afterPhase(PhaseEvent) does some operation with
conversation object, but does not it **release** from ThreadLocal

3) then I create a GET request to other view in the same application but
without any operation with conversation,
WebBeansPhaseListener.afterPhase calls
ContextFactory.destroyConversationContext(); and destroys same instance
of ConversationContext because it is still in ThreadLocal!


I think WebBeansPhaseListener.afterPhase should contains something like
this:

else
{
//Conversation must be used by one thread at a time
ConversationImpl owbConversation = (ConversationImpl)conversation;
owbConversation.updateTimeOut();
//Other threads can now access propogated conversation.
owbConversation.setInUsed(false);                

ContextFactory.releaseButNOTDestroyConversationContext();

}            


What do you think?


Regards,

Martin Kočí


Re: WebBeansPhaseListener doesn't release ConversationContext for long running conversation

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Good catch Martin,

I think it is enough to put following into WebContextService, WDYT?

private void destroyRequestContext(ServletRequestEvent request)
{
          .......

     conversationContext.set(null);
     conversationContext.remove();
}




________________________________
From: Martin Koci <ma...@aura.cz>
To: dev@openwebbeans.apache.org
Sent: Sat, August 14, 2010 6:20:19 PM
Subject: WebBeansPhaseListener doesn't release ConversationContext for long 
running conversation

Hi,

this use case probably leads to odd behaviour of conversation:

1) in first JSF request/response, in invoke application, I start long
running conversation with conversation.begin()

2) WebBeansPhaseListener.afterPhase(PhaseEvent) does some operation with
conversation object, but does not it **release** from ThreadLocal

3) then I create a GET request to other view in the same application but
without any operation with conversation,
WebBeansPhaseListener.afterPhase calls
ContextFactory.destroyConversationContext(); and destroys same instance
of ConversationContext because it is still in ThreadLocal!


I think WebBeansPhaseListener.afterPhase should contains something like
this:

else
{
//Conversation must be used by one thread at a time
ConversationImpl owbConversation = (ConversationImpl)conversation;
owbConversation.updateTimeOut();
//Other threads can now access propogated conversation.
owbConversation.setInUsed(false);                

ContextFactory.releaseButNOTDestroyConversationContext();

}            


What do you think?


Regards,

Martin Kočí