From: <tho...@us...> - 2010-09-14 10:57:28
|
Revision: 3541 http://bigdata.svn.sourceforge.net/bigdata/?rev=3541&view=rev Author: thompsonbry Date: 2010-09-14 10:57:21 +0000 (Tue, 14 Sep 2010) Log Message: ----------- Reorganized to synchronize on the buffer before testing remaining() since that depends on position(). This addresses the following stack trace for the RWStore. Caused by: java.nio.BufferOverflowException > [java] at java.nio.Buffer.nextPutIndex(Buffer.java:501) > [java] at java.nio.DirectByteBuffer.putLong(DirectByteBuffer.java:736) > [java] at com.bigdata.io.writecache.WriteCache.clearAddrMap(WriteCache.java:1761) > [java] at com.bigdata.io.writecache.WriteCacheService.clearWrite(WriteCacheService.java:1966) > [java] at com.bigdata.rwstore.RWStore.immediateFree(RWStore.java:1154) > [java] at com.bigdata.rwstore.RWStore.free(RWStore.java:1126) > [java] at com.bigdata.journal.RWStrategy.delete(RWStrategy.java:321) > [java] at com.bigdata.journal.RWStrategy.delete(RWStrategy.java:309) > [java] at com.bigdata.journal.AbstractJournal.delete(AbstractJournal.java:2625) > [java] at com.bigdata.btree.Node.replaceChildRef(Node.java:870) > [java] at com.bigdata.btree.AbstractNode.copyOnWrite(AbstractNode.java:546) > [java] at com.bigdata.btree.AbstractNode.copyOnWrite(AbstractNode.java:417) > [java] at com.bigdata.btree.Leaf.insert(Leaf.java:490) > [java] at com.bigdata.btree.Node.insert(Node.java:913) > [java] at com.bigdata.btree.Node.insert(Node.java:913) > [java] at com.bigdata.btree.Node.insert(Node.java:913) > [java] at com.bigdata.btree.AbstractBTree.insert(AbstractBTree.java:2046) > [java] at com.bigdata.btree.AbstractBTree.insert(AbstractBTree.java:1990) > [java] at com.bigdata.rdf.spo.SPOIndexWriteProc.apply(SPOIndexWriteProc.java:247) > [java] at com.bigdata.btree.UnisolatedReadWriteIndex.submit(UnisolatedReadWriteIndex.java:796) > [java] at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:332) > [java] at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:69) > [java] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > [java] at java.util.concurrent.FutureTask.run(FutureTask.java:138) > [java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > [java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > [java] at java.lang.Thread.run(Thread.java:619) Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/io/writecache/WriteCache.java Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/io/writecache/WriteCache.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/io/writecache/WriteCache.java 2010-09-13 21:00:14 UTC (rev 3540) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/io/writecache/WriteCache.java 2010-09-14 10:57:21 UTC (rev 3541) @@ -1749,26 +1749,27 @@ // } final ByteBuffer tmp = acquire(); try { - if (tmp.remaining() >= 12) { - /* - * Note: We must synchronize before having a side effect on - * position. Also see write(...) which is synchronized on - * the buffer during critical sections which have a side - * effect on the buffer position. - */ - synchronized (tmp) { - final int spos = tmp.position(); - tmp.putLong(addr); - tmp.putInt(0); - if (checker != null) { - // update the checksum (no side-effects on [data]) - final ByteBuffer chkBuf = tmp.asReadOnlyBuffer(); - chkBuf.position(spos); - chkBuf.limit(tmp.position()); - checker.update(chkBuf); - } - } // synchronized(tmp) - } + /* + * Note: We must synchronize before having a side effect on + * position (which includes depending on remaining()). Also see + * write(...) which is synchronized on the buffer during + * critical sections which have a side effect on the buffer + * position. + */ + synchronized (tmp) { + if (tmp.remaining() >= 12) { + final int spos = tmp.position(); + tmp.putLong(addr); + tmp.putInt(0); + if (checker != null) { + // update the checksum (no side-effects on [data]) + final ByteBuffer chkBuf = tmp.asReadOnlyBuffer(); + chkBuf.position(spos); + chkBuf.limit(tmp.position()); + checker.update(chkBuf); + } + } + } // synchronized(tmp) } finally { release(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |