CA-184022 : Exception happening in _deactivate_locked cause backend link not to be removed
CA-184022 : Exception happening in _deactivate_locked cause backend link not to be removed

This exception occus when the network buffer gets filled. Python
server reads the data from the buffer in chunks and not as a whole.
Hence, during heavy traffic conditions the server is forced to advertise
the receiving window size as '0' multiple times which terminates the
connection at the remote end.

As a fix we create a session inside a loop with a fixed amount of tries,
this will introduce sufficient delay for the buffer to get cleared and a
session to be created. Keeping in mind scalability we can additionally introduce
a short delay. This error is bound to occur across Xenserver where ever we are
trying to create a session, hence it would be good to foresee this issue and handle
it everytime we create a new session and the same has been done.

Post dev review, we decided to reuse the session instead of creating a new one.
We also decided to stick only to the current function where the issue has occured
since we the previous fix was touching many files.

Signed-off-by: Sharath Babu <sharath.babu@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes xapi-project/sm#279

malcolmcrossley/sm,malcolmcrossley/sm,chandrikas/sm,kostaslamda/sm,xapi-project/sm,malcolmcrossley/sm,pritha-srivastava/sm,kostaslamda/sm,germanop/sm,chandrikas/sm,germanop/sm,pritha-srivastava/sm,xapi-project/sm,kostaslamda/sm,xapi-project/sm,chandrikas/sm,pritha-srivastava/sm,germanop/sm