You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Martijn Hendriks (JIRA)" <ji...@apache.org> on 2008/04/22 14:46:29 UTC

[jira] Created: (TRANSACTION-29) NPE in OptimisticMapWrapper on concurrent commit and rollback

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.


[jira] Commented: (TRANSACTION-29) NPE in OptimisticMapWrapper on concurrent commit and rollback

Posted by "Luciano Leggieri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TRANSACTION-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620006#action_12620006 ] 

Luciano Leggieri commented on TRANSACTION-29:
---------------------------------------------

Hello,
I reproduced the steps, but couldn't get a NPE. Does it always happen? Maybe it is already solved?

> 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.