nuagenetworks / vspk-python

A Python library for managing Nuage through its API
http://www.nuagenetworks.net
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

Multi-session is not thread-safe #30

Open mainTAP opened 6 years ago

mainTAP commented 6 years ago

Hello,

Firstly I would like to thank you for the multi-sessions feature. Unfortunately the multi session capability is not quite thread safe and one can end up sending API calls using a header from another session. Which seems to be due to the shared session_stack.

As a workaround one can use use threading lock to limit one vspk call at a time, but this blocks until the response to the call is received. To minimise the blocking time, I am currently using asynchronous calls and only lock the "call send" ( maily the API call header generation I suppose ) .

It would be nice if the multi-session synchronous calls could be used thread safely.

Thank you very much.