Absolutely.

On Thu, Aug 30, 2012 at 1:14 PM, Oleg Kalnichevski <[email protected]> wrote:

> On Thu, 2012-08-30 at 12:02 -0700, Jonathan Burke wrote:
> > Hello,
> >
> >
> > Perhaps it's low priority since the comments of
> > BasicClientConnectionManager.java does say it ought to be handled by
> > only one thread but I would like to point out that it is not thread
> > safe with respect to shutdown in case you're interested.
> >
> >
> > The attached file includes a test I added to
> >
> httpclient/src/test/java/org/apache/http/impl/conn/TestBasicConnManager.java
> that will demonstrate a null pointer exception raised by potentially
> improper synchronization in BasicClientConnectionManager in relatively
> short order.
> >
> >
> > Problem:
> > Since the assignment to variable shutdown in the shutdown method (line
> > 262) is not part of the synchronize block and none of the
> > assertNotShutdown method calls are within the synchronized blocks of
> > their enclosing methods, it is possible to have threads execute the
> > commands of BasicClientConnectionManager methods in the following
> > sequence.
> >
> >
> > Thread 1
> > releaseConnection (or some other method that uses assertNotShutdown is
> > called)
> >   assertNotShutdown - Passes - Line 183
> >
> >
> > Thread 2
> > shutdown
> >   the shutdown flag becomes true - Line 262
> >   shutdown releases this.poolEntry and this.conn in the
> > synchronized(this) block
> >
> > Thread 1
> >   release connection's synchronized(this) block get's executed
> >   this.poolEntry is null in the try block causing a null pointer
> > exception - Line 211
> >   this.poolEntry is null in the finally block causing a null pointer
> > exception - Line 224
> >
> > Attached is a test case that will generate the attached stack-trace
> > when added to TestBasicConnManager and a possible fix (though the fix
> > has a cost of increased synchronization).
> >
> >
> > Thank you for your time.
> >
> >
> > Jonathan
>
> Jonathan
>
> Could you please raise a JIRA for this defect and attach the files to
> it?
>
> Oleg
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to