Skip to content

Commit 2d5051a

Browse files
committed
Remove AuthorityMonitor tracking update
The tracking update allows to avoid reloading an authority if no changes have been done to the record. To verify the changes it is used the LDAP attribute `entryUSN` which is updated by DS server on any change. The tracker update mechanism has a race condition when an entry is modified by the `CAEngine`. When the method `modifyAuthorityEntry()` is invoked, this will update the tracker and no CA are reloaded by the `AuthorityMonitor` thread because the tracker is already to the newest value. However, in case of CA clones, when a sub CA is created in the primary CA, the clone will get the record but there is no serial. The CA is registered and when the related keys are retrieved the record is update with the serial. The update is done by the `modifyAuthorityEntry()` which will update the trackers. As a result the `AuthorityMonitor` will not update the CA object and when used it will miss the serial so some operations will fails. Since, the `trackerUpdate` method has not other impact has been removed so all trackers are managed by the `AuthorityMonitor`. Fix #4669
1 parent 5978a49 commit 2d5051a

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java

-22
Original file line numberDiff line numberDiff line change
@@ -378,28 +378,6 @@ public void removeCA(AuthorityID aid) {
378378
nsUniqueIds.remove(aid);
379379
}
380380

381-
public synchronized void trackUpdate(AuthorityID aid, LDAPControl[] responseControls) {
382-
383-
LDAPPostReadControl control = (LDAPPostReadControl)
384-
LDAPUtil.getControl(LDAPPostReadControl.class, responseControls);
385-
386-
LDAPEntry entry = control.getEntry();
387-
388-
LDAPAttribute attr = entry.getAttribute("entryUSN");
389-
if (attr != null) {
390-
BigInteger entryUSN = new BigInteger(attr.getStringValueArray()[0]);
391-
logger.debug("AuthorityMonitor: tracking entryUSN: " + entryUSN);
392-
entryUSNs.put(aid, entryUSN);
393-
}
394-
395-
attr = entry.getAttribute("nsUniqueId");
396-
if (attr != null) {
397-
String nsUniqueId = attr.getStringValueArray()[0];
398-
logger.info("AuthorityMonitor: tracking nsUniqueId: " + nsUniqueId);
399-
nsUniqueIds.put(aid, nsUniqueId);
400-
}
401-
}
402-
403381
/**
404382
* Stop the activityMonitor thread
405383
*

base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java

-4
Original file line numberDiff line numberDiff line change
@@ -1723,8 +1723,6 @@ public synchronized void addAuthorityRecord(AuthorityRecord record) throws Excep
17231723
} finally {
17241724
connectionFactory.returnConn(conn);
17251725
}
1726-
1727-
authorityMonitor.trackUpdate(authorityID, responseControls);
17281726
}
17291727

17301728
public synchronized void modifyAuthorityEntry(AuthorityID aid, LDAPModificationSet mods) throws EBaseException {
@@ -1743,8 +1741,6 @@ public synchronized void modifyAuthorityEntry(AuthorityID aid, LDAPModificationS
17431741
} finally {
17441742
connectionFactory.returnConn(conn);
17451743
}
1746-
1747-
authorityMonitor.trackUpdate(aid, responseControls);
17481744
}
17491745

17501746
public synchronized void deleteAuthorityEntry(AuthorityID aid) throws EBaseException {

0 commit comments

Comments
 (0)