Mark Wu has uploaded a new change for review.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Fix a race existing in the singleton interface of clientIF
There's a race in getInstance() between clientIF initialization and MOM thread. If for some reason the initialization of clientIF is slowed down and not finished before MOM calls vdsm API, an exception will happen in MOM thread due to that the parameter 'log' is missing. The fix is just moving the parameter check into the protection of the singleton lock. Then MOM thread will be blocked if it tries to access vdsm API when the initialization of clientIF is ongoing.
Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Signed-off-by: Mark Wu wudxw@linux.vnet.ibm.com --- M vdsm/clientIF.py 1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/7283/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py index 8ba25a7..ab34eaa 100644 --- a/vdsm/clientIF.py +++ b/vdsm/clientIF.py @@ -117,13 +117,13 @@
@classmethod def getInstance(cls, log=None): - if cls._instance == None: - if log == None: - raise Exception("Logging facility is required to create \ - the single clientIF instance") with cls._instanceLock: if cls._instance == None: - cls._instance = clientIF(log) + if log == None: + raise Exception("Logging facility is required to create " + "the single clientIF instance") + else: + cls._instance = clientIF(log) return cls._instance
def _getServerIP(self, addr=None):
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/489/ : ABORTED
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Mark Wu has posted comments on this change.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Patch Set 1: Verified
I couldn't find this problem in my previous tests. Sorry for that. To trigger the race, I add a sleep after self._prepareMOM(). It's verified that this patch can resolve the problem.
Here's the traceback message: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/mom/__init__.py", line 185, in get_hypervisor_interface return module.instance(self.config) File "/usr/lib/python2.7/site-packages/mom/HypervisorInterfaces/vdsmInterface.py", line 160, in instance return vdsmInterface() File "/usr/lib/python2.7/site-packages/mom/HypervisorInterfaces/vdsmInterface.py", line 36, in __init__ self.vdsm_api = API.Global() File "/usr/share/vdsm/API.py", line 974, in __init__ APIBase.__init__(self) File "/usr/share/vdsm/API.py", line 55, in __init__ self._cif = clientIF.getInstance() File "/usr/share/vdsm/clientIF.py", line 123, in getInstance the single clientIF instance") Exception: Logging facility is required to create the single clientIF instance
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Royce Lv has posted comments on this change.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Adam Litke has posted comments on this change.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Patch Set 1: Verified; Looks good to me, but someone else must approve
Verified that this fixes the issue for me. Thanks for the patch Mark. Dan, please apply.
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Patch Set 1: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: Fix a race existing in the singleton interface of clientIF ......................................................................
Fix a race existing in the singleton interface of clientIF
There's a race in getInstance() between clientIF initialization and MOM thread. If for some reason the initialization of clientIF is slowed down and not finished before MOM calls vdsm API, an exception will happen in MOM thread due to that the parameter 'log' is missing. The fix is just moving the parameter check into the protection of the singleton lock. Then MOM thread will be blocked if it tries to access vdsm API when the initialization of clientIF is ongoing.
Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Signed-off-by: Mark Wu wudxw@linux.vnet.ibm.com --- M vdsm/clientIF.py 1 file changed, 5 insertions(+), 5 deletions(-)
Approvals: Adam Litke: Verified; Looks good to me, but someone else must approve Royce Lv: Looks good to me, but someone else must approve Mark Wu: Verified Dan Kenigsberg: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/7283 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org