You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by Matthew Bellew <mb...@fhcrc.org> on 2007/03/22 21:19:58 UTC

FlowController.incrementRequestCount() bug

FlowController.incrementRequestCount() and 
FlowController.decrementRequestCount() access the variables 
_requestCount and _maxConcurrentRequestCount outside of any synchronized 
block.  This makes it possible to _requestCount, especially on a 
multi-processor machine.  The subtlety of this bug is that 
--_requestCount and ++_requestCount look atomic, but they are not.

In particular, we have an action that returns images.  Since some pages 
contain many images, this controller can be hit my many requests 
concurrently from the same session.  We hit the decrementRequestCount() 
assert quite frequently in production.

        assert _requestCount > 0 : request.getRequestURI();

Thanks,
Matt



Re: FlowController.incrementRequestCount() bug

Posted by Carlin Rogers <ca...@gmail.com>.
Hey Matt,

Thanks for the detailed information! Can you log this in JIRA? The
Beehive project URL is https://issues.apache.org/jira/browse/BEEHIVE.
You may have to create a log in.

Thanks again. Appreciate the help.

Kind regards,
Carlin

On 3/22/07, Matthew Bellew <mb...@fhcrc.org> wrote:
> FlowController.incrementRequestCount() and
> FlowController.decrementRequestCount() access the variables
> _requestCount and _maxConcurrentRequestCount outside of any synchronized
> block.  This makes it possible to _requestCount, especially on a
> multi-processor machine.  The subtlety of this bug is that
> --_requestCount and ++_requestCount look atomic, but they are not.
>
> In particular, we have an action that returns images.  Since some pages
> contain many images, this controller can be hit my many requests
> concurrently from the same session.  We hit the decrementRequestCount()
> assert quite frequently in production.
>
>         assert _requestCount > 0 : request.getRequestURI();
>
> Thanks,
> Matt
>
>
>

Re: FlowController.incrementRequestCount() bug

Posted by Rich Feit <ri...@gmail.com>.
Just catching up on these threads.  These two variables should simply be 
volatile, right?

Matthew Bellew wrote:
> FlowController.incrementRequestCount() and 
> FlowController.decrementRequestCount() access the variables 
> _requestCount and _maxConcurrentRequestCount outside of any 
> synchronized block.  This makes it possible to _requestCount, 
> especially on a multi-processor machine.  The subtlety of this bug is 
> that --_requestCount and ++_requestCount look atomic, but they are not.
>
> In particular, we have an action that returns images.  Since some 
> pages contain many images, this controller can be hit my many requests 
> concurrently from the same session.  We hit the 
> decrementRequestCount() assert quite frequently in production.
>
>        assert _requestCount > 0 : request.getRequestURI();
>
> Thanks,
> Matt
>
>
>