Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.3
-
None
Description
As reported by Petr Juza, a NullPointerException can be triggered by the ConversationWiperThread:
Exception in thread
"org.apache.myfaces.orchestra.conversation.ConversationWiperThread"
java.lang.NullPointerException
at
org.apache.myfaces.orchestra.conversation.ConversationManager.findConver
sationContextId(ConversationManager.java:140)
at
org.apache.myfaces.orchestra.conversation.ConversationManager.removeAndI
nvalidateConversationContext(ConversationManager.java:343)
at
org.apache.myfaces.orchestra.conversation.ConversationManager.checkTimeo
uts(ConversationManager.java:626)
at
org.apache.myfaces.orchestra.conversation.ConversationWiperThread._run(C
onversationWiperThread.java:113)
at
org.apache.myfaces.orchestra.conversation.ConversationWiperThread.run(Co
nversationWiperThread.java:90)
After initial investigation, the problem appears to be that the ConversationWiperThread is detecting a ConversationContext timeout, and so is trying to delete the ConversationContext. However in the ConversationManager.removeAndInvalidateConversationContext(ctx) method, a check is done to see if the context being removed is the "current one", in order to prevent code within a request from accidentally deleting the context that is being used to process that request. However this check requires the FrameworkAdapter - but there is no FrameworkAdapter instance for a background thread like the ConversationWiperThread:
public void removeAndInvalidateConversationContext(ConversationContext context)
{
.....
if (context.getIdAsLong().equals(findConversationContextId()))
...
where findConversationContextId tries to use FrameworkAdapter to look in the current HttpRequest object.
Here, we could check whether a FrameworkAdapter exists, and if not then assume that the context is not the "current" one. Ideally, we would actually block the wiper thread from deleting a context if it is "locked", but the odds of a context timing out while actually in use are very low indeed.
I'm a little puzzled why I don't see this exception in the logs for my apps that use Orchestra...
Note that this exception is fairly harmless: it just disables the ConversationWiperThread
Attachments
Issue Links
- is duplicated by
-
ORCHESTRA-41 NullPointerException in method findConversationContextId
- Resolved