You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/01/04 00:56:00 UTC

[jira] [Work logged] (DBCP-569) Fix test random failure on TestSynchronizationOrder.testInterposedSynchronization

     [ https://issues.apache.org/jira/browse/DBCP-569?focusedWorklogId=530497&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-530497 ]

ASF GitHub Bot logged work on DBCP-569:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jan/21 00:55
            Start Date: 04/Jan/21 00:55
    Worklog Time Spent: 10m 
      Work Description: efge opened a new pull request #84:
URL: https://github.com/apache/commons-dbcp/pull/84


   See [DBCP-569](https://issues.apache.org/jira/browse/DBCP-569).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 530497)
    Remaining Estimate: 0h
            Time Spent: 10m

> Fix test random failure on TestSynchronizationOrder.testInterposedSynchronization
> ---------------------------------------------------------------------------------
>
>                 Key: DBCP-569
>                 URL: https://issues.apache.org/jira/browse/DBCP-569
>             Project: Commons DBCP
>          Issue Type: Bug
>            Reporter: Florent Guillaume
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{TestSynchronizationOrder.testInterposedSynchronization}} may fail randomly depending on GC behavior, because the test involves a {{Transaction}} object held only be weak references, which may be cleared earlier that the test expects:
> {noformat}
> java.sql.SQLException: Unable to enlist connection because the transaction has been garbage collected
> 	at org.apache.commons.dbcp2.managed.TransactionContext.getTransaction(TransactionContext.java:186)
> 	at org.apache.commons.dbcp2.managed.TransactionContext.setSharedConnection(TransactionContext.java:105)
> 	at org.apache.commons.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:310)
> 	at org.apache.commons.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:89)
> 	at org.apache.commons.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:64)
> 	at org.apache.commons.dbcp2.managed.TestSynchronizationOrder.testInterposedSynchronization(TestSynchronizationOrder.java:118)
> {noformat}
> 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. The fake {{TransactionManager}} should create the fake {{Transaction}} at {{begin()}} time, and hold onto it using a strong reference until {{commit()}} time.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)