commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn Hendriks (JIRA)" <j...@apache.org>
Subject [jira] Created: (TRANSACTION-29) NPE in OptimisticMapWrapper on concurrent commit and rollback
Date Tue, 22 Apr 2008 12:46:29 GMT
NPE in OptimisticMapWrapper on concurrent commit and rollback
-------------------------------------------------------------

                 Key: TRANSACTION-29
                 URL: https://issues.apache.org/jira/browse/TRANSACTION-29
             Project: Commons Transaction
          Issue Type: Bug
    Affects Versions: 1.3
         Environment: Revision: 650440
            Reporter: Martijn Hendriks


When multiple transactions for an OptimisticMapWrapper are concurrently executing, a NPE can
be thrown if one transaction is committed and one is rolled back. This can be reproduced with
the following code (based on testMulti in the OptimisticMapWrapperTest class):

        final Map map1 = new HashMap();
        final OptimisticMapWrapper txMap1 = (OptimisticMapWrapper) getNewWrapper(map1);
        Thread thread1 = new Thread(new Runnable() {
        	public void run() {
        		txMap1.startTransaction();
        		txMap1.put("key1", "value2");
        		txMap1.commitTransaction();
            }
        }, "Thread1");
        txMap1.put("key1", "value1");
        txMap1.startTransaction();
        thread1.start();
        txMap1.rollbackTransaction();

* Set breakpoints at line 363 and 137 in OptimisticMapWrapper
* Run the code above with the debugger attached
* Step through the dispose method (release the lock)
* Continue the other thread; it will give the NPE

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message