You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Florent Guillaume <fg...@nuxeo.com> on 2021/01/02 19:39:10 UTC

Re: [DBCP] TestSynchronizationOrder failure, random or bug

Hi Gary,

I reproduce it too in my Eclipse. I think it's a bug in the test.

The TransactionContext.transactionRef and the TransactionRegistry.caches
are holding onto the Transaction (acquired in
TransactionRegistry.getActiveTransactionContext()) only using weak refs.
However in TestSynchronizationOrder the fake TransactionManager returns a
Transaction (that's an instance of an anonymous class) but nobody holds a
strong reference to that. I think that the fake TransactionManager should
create the fake Transaction at begin() time, and hold onto it using a
strong reference until commit() time.

Florent


On Tue, Dec 29, 2020 at 7:56 PM Gary Gregory <ga...@gmail.com> wrote:

> Hi All:
>
> I just saw on
>
> https://github.com/apache/commons-dbcp/runs/1622526568?check_suite_focus=true
>
> [INFO] Running org.apache.commons.dbcp2.managed.TestSynchronizationOrder
> Error:  Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> 0.088 s <<< FAILURE! - in
> org.apache.commons.dbcp2.managed.TestSynchronizationOrder
> Error:  testInterposedSynchronization  Time elapsed: 0.077 s  <<< ERROR!
> java.sql.SQLException: Unable to enlist connection because the transaction
> has been garbage collected
> at
>
> org.apache.commons.dbcp2.managed.TestSynchronizationOrder.testInterposedSynchronization(TestSynchronizationOrder.java:118)
>
> Is this random or a bug?
>
> Gary
>


-- 
[image: Nuxeo Logo] <https://www.nuxeo.com/>

Florent Guillaume  Head of R&D  [image: LinkedIn]
<https://www.linkedin.com/in/fguillaume/> [image: Twitter]
<https://twitter.com/efge> [image: Github] <https://github.com/efge>

Nuxeo Content Services Platform. Stay ahead.

Re: [DBCP] TestSynchronizationOrder failure, random or bug

Posted by Florent Guillaume <fg...@nuxeo.com>.
Here it is:
https://github.com/apache/commons-dbcp/pull/84
associated to ticket:
https://issues.apache.org/jira/browse/DBCP-569

Florent

On Mon, Jan 4, 2021 at 12:24 AM Gary Gregory <ga...@gmail.com> wrote:

> On Sat, Jan 2, 2021 at 2:39 PM Florent Guillaume <fg...@nuxeo.com>
> wrote:
>
> > Hi Gary,
> >
> > I reproduce it too in my Eclipse. I think it's a bug in the test.
> >
> > The TransactionContext.transactionRef and the TransactionRegistry.caches
> > are holding onto the Transaction (acquired in
> > TransactionRegistry.getActiveTransactionContext()) only using weak refs.
> > However in TestSynchronizationOrder the fake TransactionManager returns a
> > Transaction (that's an instance of an anonymous class) but nobody holds a
> > strong reference to that. I think that the fake TransactionManager should
> > create the fake Transaction at begin() time, and hold onto it using a
> > strong reference until commit() time.
> >
>
> Florent,
>
> Thank you for your analysis.
>
> May you please create a PR to bulletproof the test as you described?
>
> Gary
>
>
> > Florent
> >
> >
> > On Tue, Dec 29, 2020 at 7:56 PM Gary Gregory <ga...@gmail.com>
> > wrote:
> >
> > > Hi All:
> > >
> > > I just saw on
> > >
> > >
> >
> https://github.com/apache/commons-dbcp/runs/1622526568?check_suite_focus=true
> > >
> > > [INFO] Running
> org.apache.commons.dbcp2.managed.TestSynchronizationOrder
> > > Error:  Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> > > 0.088 s <<< FAILURE! - in
> > > org.apache.commons.dbcp2.managed.TestSynchronizationOrder
> > > Error:  testInterposedSynchronization  Time elapsed: 0.077 s  <<<
> ERROR!
> > > java.sql.SQLException: Unable to enlist connection because the
> > transaction
> > > has been garbage collected
> > > at
> > >
> > >
> >
> org.apache.commons.dbcp2.managed.TestSynchronizationOrder.testInterposedSynchronization(TestSynchronizationOrder.java:118)
> > >
> > > Is this random or a bug?
> > >
> > > Gary
> > >
> >
> >
> > --
> > [image: Nuxeo Logo] <https://www.nuxeo.com/>
> >
> > Florent Guillaume  Head of R&D  [image: LinkedIn]
> > <https://www.linkedin.com/in/fguillaume/> [image: Twitter]
> > <https://twitter.com/efge> [image: Github] <https://github.com/efge>
> >
> > Nuxeo Content Services Platform. Stay ahead.
> >
>


-- 
[image: Nuxeo Logo] <https://www.nuxeo.com/>

Florent Guillaume  Head of R&D  [image: LinkedIn]
<https://www.linkedin.com/in/fguillaume/> [image: Twitter]
<https://twitter.com/efge> [image: Github] <https://github.com/efge>

Nuxeo Content Services Platform. Stay ahead.

Re: [DBCP] TestSynchronizationOrder failure, random or bug

Posted by Gary Gregory <ga...@gmail.com>.
On Sat, Jan 2, 2021 at 2:39 PM Florent Guillaume <fg...@nuxeo.com>
wrote:

> Hi Gary,
>
> I reproduce it too in my Eclipse. I think it's a bug in the test.
>
> The TransactionContext.transactionRef and the TransactionRegistry.caches
> are holding onto the Transaction (acquired in
> TransactionRegistry.getActiveTransactionContext()) only using weak refs.
> However in TestSynchronizationOrder the fake TransactionManager returns a
> Transaction (that's an instance of an anonymous class) but nobody holds a
> strong reference to that. I think that the fake TransactionManager should
> create the fake Transaction at begin() time, and hold onto it using a
> strong reference until commit() time.
>

Florent,

Thank you for your analysis.

May you please create a PR to bulletproof the test as you described?

Gary


> Florent
>
>
> On Tue, Dec 29, 2020 at 7:56 PM Gary Gregory <ga...@gmail.com>
> wrote:
>
> > Hi All:
> >
> > I just saw on
> >
> >
> https://github.com/apache/commons-dbcp/runs/1622526568?check_suite_focus=true
> >
> > [INFO] Running org.apache.commons.dbcp2.managed.TestSynchronizationOrder
> > Error:  Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> > 0.088 s <<< FAILURE! - in
> > org.apache.commons.dbcp2.managed.TestSynchronizationOrder
> > Error:  testInterposedSynchronization  Time elapsed: 0.077 s  <<< ERROR!
> > java.sql.SQLException: Unable to enlist connection because the
> transaction
> > has been garbage collected
> > at
> >
> >
> org.apache.commons.dbcp2.managed.TestSynchronizationOrder.testInterposedSynchronization(TestSynchronizationOrder.java:118)
> >
> > Is this random or a bug?
> >
> > Gary
> >
>
>
> --
> [image: Nuxeo Logo] <https://www.nuxeo.com/>
>
> Florent Guillaume  Head of R&D  [image: LinkedIn]
> <https://www.linkedin.com/in/fguillaume/> [image: Twitter]
> <https://twitter.com/efge> [image: Github] <https://github.com/efge>
>
> Nuxeo Content Services Platform. Stay ahead.
>