[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: |
|
||||||||
| 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 |