Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
Helium
-
None
-
None
-
Operating System: Mac OS
Platform: PC
-
945
Description
There are concurrency issues that were introduced with CONTROLLER-317 / gerrit 6253 in the NetconfDevice.java. Specifically, in the "bringUp" method we set the value of a number of class scoped variables, but those variables are not synchronized or volatile. This can result in a race condition with the other locations where these member variables are used.
See gerrit 6253 for one example.
Offending Code:
void bringUp(final SchemaSourceProvider<String> delegate, final Set<QName> capabilities, final boolean rollbackSupported) {
// This has to be called from separate thread, not from netty thread calling onSessionUp in DeviceListener.
// Reason: delegate.getSchema blocks thread when waiting for response
// however, if the netty thread is blocked, no incoming message can be processed
// ... netty should pick another thread from pool to process incoming message, but it does not http://netty.io/wiki/thread-model.html
// TODO redesign +refactor
processingExecutor.submit(new Runnable() {
@Override
public void run() {
NetconfDevice.this.rollbackSupported = rollbackSupported;
remoteSourceProvider = schemaSourceProvider.createInstanceFor(delegate);
deviceContextProvider = new NetconfDeviceSchemaContextProvider(NetconfDevice.this, remoteSourceProvider);
deviceContextProvider.createContextFromCapabilities(capabilities);
if (mountInstance != null && getSchemaContext().isPresent())
updateDeviceState(true, capabilities);
if (mountInstance != null) {
confReaderReg = mountInstance.registerConfigurationReader(ROOT_PATH, NetconfDevice.this);
operReaderReg = mountInstance.registerOperationalReader(ROOT_PATH, NetconfDevice.this);
commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, NetconfDevice.this);
List<RpcRegistration> rpcs = new ArrayList<>();
// TODO same condition twice
if (mountInstance != null && getSchemaContext().isPresent()) {
for (RpcDefinition rpc : mountInstance.getSchemaContext().getOperations())
}
rpcReg = rpcs;
}
}
});
}