On Mon, Jan 10, 2011 at 4:57 PM, Alex Dean <a...@crackpot.org> wrote:

>
> On Jan 10, 2011, at 5:02 AM, Jeff Rose wrote:
>
> > On Sat, Jan 8, 2011 at 2:11 AM, Alex Dean <a...@crackpot.org> wrote:
> > 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
> >
> > Hi Alex,
> >   I'm not able to apply your patch, either to the latest from SVN or to
> revision 1052368 which is specified in the patch.  For example, in
> MessageListenerServlet.java I don't have any reference to the
> unconsumedMessages linked list.  Can you generate the patch against the
> latest from SVN so I can give it a try?  I've got everything setup again to
> test with my initial PHP and javascript configuration.
>
> Sure.  I'll update to trunk HEAD and re-send the patch.
>
> unconsumedMessages was added to AjaxListener in r1052259, so if you've got
> HEAD you should have it.
> http://svn.apache.org/viewvc?view=revision&revision=1052259
>
> Updated patch (now based on trunk r1057227) is at
> https://issues.apache.org/jira/secure/attachment/12467892/all_messages_are_delivered_to_ajax_clients.2.patch
>
> alex


Nice, this is working much better.  Now I can see that responses are
sometimes spread across multiple <ajax-response> elements, and I'm not
getting random dropped messages like before.

The last issue I do see is that fairly often the consumer stops listening to
the topic even though the ajax poll requests are still coming.  I can see in
jconsole that the consumer count on my topic drops to zero, even though at
the same time I'm watching empty ajax responses coming back periodically.

-Jeff

Reply via email to