2011/5/16 Eric Blake <eblake@xxxxxxxxxx>: > On 05/01/2011 01:57 PM, Matthias Bolte wrote: >> When the session has expired then multiple threads can race while >> reestablishing it. >> >> This race condition is not that critical as it requires a special usage >> pattern to be triggerd. It can only happen when an application doesn't > > s/triggerd/triggered/ Fixed. >> do API calls for quite some time (the session expires after 30 min >> inactivity) and then multiple threads doing simultaneous API calls and >> end up doing simultaneous calls to esxVI_EnsureSession. >> --- >> Âsrc/esx/esx_vi.c | Â 47 +++++++++++++++++++++++++++++++++++------------ >> Âsrc/esx/esx_vi.h | Â Â4 +++- >> Â2 files changed, 38 insertions(+), 13 deletions(-) > > C code - I'm back in my element! > >> +++ b/src/esx/esx_vi.h >> @@ -185,6 +185,7 @@ int esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxVI_CURL *curl); >> Â */ >> >> Âstruct _esxVI_Context { >> + Â Â/* All members are used read-only after esxVI_Context_Connect ... */ >> Â Â ÂesxVI_CURL *curl; >> Â Â Âchar *url; >> Â Â Âchar *ipAddress; >> @@ -193,7 +194,8 @@ struct _esxVI_Context { >> Â Â ÂesxVI_ServiceContent *service; >> Â Â ÂesxVI_APIVersion apiVersion; >> Â Â ÂesxVI_ProductVersion productVersion; >> - Â ÂesxVI_UserSession *session; >> + Â ÂesxVI_UserSession *session; /* ... except the session ... */ >> + Â ÂvirMutexPtr sessionLock; /* ... that is protected by this mutex */ > > ACK, and thanks for those comments. > Thanks, pushed. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list