cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
96
Views
0
Helpful
1
Replies

Device timeout when attempting a sync/check-sync/connect

khgrant
Cisco Employee
Cisco Employee

I am developing a service package, which involves creation of a Virtual Router and pushing configs to that device.

I am able to create the Virtual device and add it to NCS using MAAPI.

But, when the NCS tries to do any of check-sync/sync-from/connect, the service package deployment gets hung forever.

When the deployment is hung, I have verified that the device is reachable and I am able to login to device from a different terminal.

And I have also been able to do check-sync/sync-from/connect operations successfully from the NCS CLI(Not when the deployment is hung).

I understand I have not shared much info here.

But, I am hoping that somebody might have run into this issue earlier,

And found out a logical fix to their program which might be a standard way of implementation.

I have used RFM. Didn’t mention that in my previous email.

The main service package issues VM related commands,

And only proceeds to apply configs once the VMs are up, added and synced to NCS.

The event handling is implemented in an Application component.

In this program, when I get VM_ALIVE,

I add the device to NCS – (successful).

Immediately after that, I try to sync the device.

But, this sync operation gets hung, does not return until I manually kill the java VM.

The program flow is something like this,

Init() {

// has subscribed to netconf notifications from ESC

// calls handler_function()

}

Handler_function() {

If (VM_ALIVE) {

Th = maapi.startTrans(Conf.DB_RUNNING, Conf.MODE_READ_WRITE);

addDevicetoNCS(device_name, ip);

maapi.applyTrans(th, false);

maapi.finishTrans(th);

sync_device(maapi, device_name);  // This is where it gets stuck.

}

}

1 ACCEPTED SOLUTION

Accepted Solutions

khgrant
Cisco Employee
Cisco Employee

First of all, creating a virtual router within the same transaction as configuring it is normally not  a good idea, since spinning up a VM takes time and will keep the transaction. Use the Reactive FASTMAP pattern so that spinning up a VM is one phase and configuring it another.

If the handler_function is triggered by a subscription, there is a CDB lock that prevents the sync operation from completing. And the lock is never released, because it is waiting for the subscriber to complete… Deadlock. You need to issue the sync in a separate thread (again).

View solution in original post

1 REPLY 1

khgrant
Cisco Employee
Cisco Employee

First of all, creating a virtual router within the same transaction as configuring it is normally not  a good idea, since spinning up a VM takes time and will keep the transaction. Use the Reactive FASTMAP pattern so that spinning up a VM is one phase and configuring it another.

If the handler_function is triggered by a subscription, there is a CDB lock that prevents the sync operation from completing. And the lock is never released, because it is waiting for the subscriber to complete… Deadlock. You need to issue the sync in a separate thread (again).

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: