Revision: 19511 http://sourceforge.net/p/gate/code/19511 Author: ian_roberts Date: 2016-08-18 13:09:15 +0000 (Thu, 18 Aug 2016) Log Message: ----------- Removed the synchronization around access to compactIndexTask and batchWriteTask - we hit a nasty deadlock where a compact request came in from the maintenance thread at the split second when a sync to disk finished *and* the indexing input queue was full, which resulted in the indexing and maintenance threads becoming blocked against each other. Removing these synchronization points will stop that from happening again, and both Mark and I have audited the code and believe it is safe without the synchronization.
Modified Paths: -------------- mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java Modified: mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java =================================================================== --- mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java 2016-08-18 01:23:07 UTC (rev 19510) +++ mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java 2016-08-18 13:09:15 UTC (rev 19511) @@ -1461,7 +1461,7 @@ * @throws InterruptedException if this thread is interrupted while trying to * queue the dump request. */ - public synchronized Future<Long> requestSyncToDisk() throws InterruptedException { + public Future<Long> requestSyncToDisk() throws InterruptedException { if(batchWriteTask == null) { batchWriteTask = new FutureTask<Long>(new Callable<Long>() { @Override @@ -1483,7 +1483,7 @@ * @throws InterruptedException if this thread is interrupted while trying to * queue the compaction request. */ - public synchronized Future<Void> requestCompactIndex() throws InterruptedException { + public Future<Void> requestCompactIndex() throws InterruptedException { if(compactIndexTask == null) { compactIndexTask = new FutureTask<Void>(new Callable<Void>(){ @Override @@ -1596,17 +1596,13 @@ if(batchWriteTask != null){ batchWriteTask.run(); } - synchronized(this) { - batchWriteTask = null; - } + batchWriteTask = null; } else if(aDocument == COMPACT_INDEX) { // compress index was requested if(compactIndexTask != null) { compactIndexTask.run(); } - synchronized(this) { - compactIndexTask = null; - } + compactIndexTask = null; } else { try { long occurencesBefore = occurrencesInRAM; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ GATE-cvs mailing list GATE-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gate-cvs