[NETCONF-695] Rpc future doesn't complete when transformer fails Created: 28/May/20  Updated: 16/Jun/20  Resolved: 16/Jun/20

Status: Resolved
Project: netconf
Component/s: netconf
Affects Version/s: Aluminium
Fix Version/s: Aluminium, Magnesium SR2

Type: Bug Priority: Medium
Reporter: Andrej Mak Assignee: Jamo Luhrsen
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
is blocked by NETCONF-666 500 response without provided rpc fai... Resolved

 Description   

 

When netconf message transformer fails to parse reply(e.g. because of https://jira.opendaylight.org/browse/NETCONF-645), result future is stuck and never completes.

Following test proves the problem. It can be pasted to org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceRpcTest.

@Test
public void testDeadlock() throws Exception {
    // when rpc is successful, but transformer fails for some reason
    final MessageTransformer<NetconfMessage> failingTransformer = mock(MessageTransformer.class);
    final RemoteDeviceCommunicator<NetconfMessage> communicatorMock = mock(RemoteDeviceCommunicator.class);
    final NetconfMessage msg = null;
    final RpcResult<NetconfMessage> result = RpcResultBuilder.success(msg).build();
    when(communicatorMock.sendRequest(any(), any())).thenReturn(Futures.immediateFuture(result));
    when(failingTransformer.toRpcResult(any(), any())).thenThrow(new RuntimeException("FAIL"));
    final NetconfDeviceRpc rpc = new NetconfDeviceRpc(SCHEMA_CONTEXT, communicatorMock, failingTransformer);
    // then guava logs and swallow exception and future never completes
    rpc.invokeRpc(path, null).get();
}

 



 Comments   
Comment by Jamo Luhrsen [ 04/Jun/20 ]

a basic try to address this is here

I welcome review comments to get it right. The UT given in this JIRA is part of the patch and passes
now as the future returns with an exception when it's given the bad transformer.

Generated at Wed Feb 07 20:15:40 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.