Author: kwright
Date: Sun Apr 26 10:27:32 2015
New Revision: 1676094

URL: http://svn.apache.org/r1676094
Log:
Fix for CONNECTORS-1191

Modified:
    manifoldcf/trunk/CHANGES.txt
    
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1676094&r1=1676093&r2=1676094&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Sun Apr 26 10:27:32 2015
@@ -6,6 +6,11 @@ $Id$
 
 ======================= Release 2.1 =====================
 
+CONNECTORS-1191: Unexpected job status 34, due to a race condition.
+Jobs shutting down and being aborted at the same time could wind up
+in a state where repeated exceptions would be thrown.
+(Arcadius Ahouansou, Karl Wright)
+
 CONNECTORS-1190: Broken dependencies in solr connector maven build
 caused tests to fail under maven.
 (Piergiorgio Lucidi, Karl Wright)

Modified: 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1676094&r1=1676093&r2=1676094&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
 (original)
+++ 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
 Sun Apr 26 10:27:32 2015
@@ -39,7 +39,6 @@ public class JobManager implements IJobM
   protected static final String cleanStufferLock = "_CLEANSTUFFER_";
   protected static final String jobStopLock = "_JOBSTOP_";
   protected static final String jobResumeLock = "_JOBRESUME_";
-  protected static final String jobResetLock = "_JOBRESET_";
   protected static final String hopLock = "_HOPLOCK_";
 
   // Member variables
@@ -8339,7 +8338,9 @@ public class JobManager implements IJobM
   {
     // Alternative to using a write lock here: Put this in a transaction, with 
a "FOR UPDATE" on the first query.
     // I think that still causes way too much locking, though, on some 
databases.
-    lockManager.enterWriteLock(jobResetLock);
+    // Note well: This MUST be the same lock as for finishStopJobs, since 
ABORTINGSHUTTINGDOWN is handled
+    // by one and SHUTTINGDOWN is handled by the other.  CONNECTORS-1191.
+    lockManager.enterWriteLock(jobStopLock);
     try
     {
       // Query for all jobs that fulfill the criteria
@@ -8417,7 +8418,7 @@ public class JobManager implements IJobM
     }
     finally
     {
-      lockManager.leaveWriteLock(jobResetLock);
+      lockManager.leaveWriteLock(jobStopLock);
     }
   }
 


Reply via email to