On Dec 14, 2010, at 9:48 AM, Jeff Rose wrote:

> Hi Alex,
>  Thanks for the response.  We looked into it a bit more based on your
> suggestion, and we discovered that there is an error occurring when the
> continuation is resumed in onMessageAvailable in AjaxListener.java.  It
> looks like this onMessageAvailable handler is being called every time a new
> message arrives on the queue, and then it is trying to resume a continuation
> that has already been resumed, which causes an illegal state exception.
> We've been trying to fix the bug  by checking first:
> 
>   !continuation.isResumed()
> 
> but we are still getting the error occasionally (although it does often get
> all of the messages now).  This seems to be a pretty fundamental bug in the
> AJAX support of ActiveMQ.  Definitely worth posting a ticket (although I
> don't know where that is done).

Jeff: I attached a patch to AMQ-3094 which I think fixes this problem.  A 
continuation can be in more states than just initial & resumed, so checking 
!continuation.isResumed() can still result in illegal state exceptions.  I 
changed your suggestion so AjaxListener only tries to resume a continuation 
"if( continuation.isSuspended() )".  Otherwise it buffers the message for 
delivery in the next poll (building on some code Dejan committed a few days 
ago).

Let me know if you have time to test this patch, and if it solves the issue for 
you.  It looks good in my tests so far.

https://issues.apache.org/jira/secure/attachment/12467757/all_messages_are_delivered_to_ajax_clients.patch
 

alex

Reply via email to