[ 
http://jira.amdatu.org/jira/browse/AMDATUCASSANDRA-130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11863#comment-11863
 ] 

Ivo Ladage - van Doorn edited comment on AMDATUCASSANDRA-130 at 11/4/11 1:57 PM:
---------------------------------------------------------------------------------

After analyzing the issue, I found out that it is caused by the HashBiMap used 
in org.apache.cassandra.config.CFMetaData not being thread-safe. This 
bidirectional map comes from the Guava project (guava-r08) and never claimed to 
be thread-safe. Cassandra uses this map and does not take any precautions to 
prevent concurrency problems. By running the attached Unit test you can 
reproduce the concurrency issue quite easily. If you uncomment the synchronized 
stuff around the map access methods, the unit test will fail.

Of course, this could easily be fixed in Cassandra (by adding synchronized 
snippets), but there is a trade-off between thread-safety and lock contention. 
Since this map maps CF name onto CF id, it is justifiable to not be 
thread-safe. ColumnFamilies are not created very often, so the use case 
performed by our performance test is not likely to occur in a real life 
situation.
                
      was (Author: ivol):
    After analyzing the issue, I found out that it is caused by the HashBiMap 
used in org.apache.cassandra.config.CFMetaData not being thread-safe. This 
bidirectional map comes from the Guava project (guava-r08) and never claimed to 
be thread-safe. Cassandra uses this map and does not take any precautions to 
prevent concurrency problems. By running the attached Unit test you can 
reproduce the concurrency issue quite easily.
                  
> NullPointerExceptions occur during running the cassandra performance tests
> --------------------------------------------------------------------------
>
>                 Key: AMDATUCASSANDRA-130
>                 URL: http://jira.amdatu.org/jira/browse/AMDATUCASSANDRA-130
>             Project: Amdatu Cassandra
>          Issue Type: Bug
>          Components: Cassandra daemon
>    Affects Versions: 0.2.0
>            Reporter: Ivo Ladage - van Doorn
>         Attachments: ConcurrencyTest.java
>
>
> When I run the Cassandra performance test, sometimes I get this 
> NullPointerException:
> [2011-10-18 11:05:38] ERROR: Fatal exception in thread 
> Thread[COMMIT-LOG-WRITER,5,main] [org.amdatu.core.loghandler]
> java.lang.RuntimeException: java.lang.NullPointerException
>       at 
> org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:34)
>       at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.cassandra.db.RowMutation$RowMutationSerializer.serialize(RowMutation.java:352)
>       at 
> org.apache.cassandra.db.RowMutation.getSerializedBuffer(RowMutation.java:236)
>       at 
> org.apache.cassandra.db.commitlog.CommitLogSegment.write(CommitLogSegment.java:106)
>       at 
> org.apache.cassandra.db.commitlog.CommitLog$LogRecordAdder.run(CommitLog.java:498)
>       at 
> org.apache.cassandra.db.commitlog.PeriodicCommitLogExecutorService$1.runMayThrow(PeriodicCommitLogExecutorService.java:49)
>       at 
> org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:30)
>       ... 1 more
> This happens randomly every now and then, but you have to run the test for a 
> long time to reproduce it. However, the problem always appears.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
http://jira.amdatu.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to