You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileChangelogDB.removeDomain() throws NullPointerException when it races shutdownDB() #816
shutdownDB() removes the same entry, under the same monitor, in its drain of domainToReplicaDBs (:355-366). A removeDomain() which acquires that monitor after the
drain has released it therefore gets null back from remove(baseDN) and dereferences it on
the very next line.
The result is a NullPointerException where the caller expects a ChangelogException: ReplicationServerDomain.clearDbs() (:2066-2076) catches ChangelogException only, so the
NPE propagates out of the generation id change which called it.
The same window exists between two concurrent removeDomain() calls, and between removeDomain() and clearDB(), which calls it for every domain it finds (:478).
Proposed fix
Remove conditionally, and keep iterating the map the monitor was taken on:
synchronized (domainMap)
{
domainToReplicaDBs.remove(baseDN, domainMap);
for (FileReplicaDBreplicaDB : domainMap.values())
A replica DB which the drain has already released is then visited twice, which is harmless: Log.clear() returns at once on a closed log (Log.java:772-780) and FileReplicaDB.shutdown()
is guarded by a CAS (FileReplicaDB.java:218).
Activity
[#816] Unmap only the locked domainMap in FileChangelogDB.removeDomai…