Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-695

Rpc future doesn't complete when transformer fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Aluminium, Magnesium SR2
    • Aluminium
    • netconf
    • None

       

      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();
      }

       

            jluhrsen Jamo Luhrsen
            andmak Andrej Mak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: