Skip to content

Commit

Permalink
Port in use error caused by gevent threads
Browse files Browse the repository at this point in the history
If the first launch of a service VM coincides with the
timer for service instance check then there is a possibility
that the same port might be used to launch service VMs.
Added mutual exclusion to ensure that the timer check only
happens after the first launch.

Change-Id: Ieef15683f20e08cd1df221ff17a0c9fed4cf6b89
Closes-Bug: #1463745
  • Loading branch information
rrugge committed Jun 23, 2015
1 parent 0655865 commit 25b696d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config/svc-monitor/svc_monitor/config_db.py
Expand Up @@ -317,6 +317,7 @@ def __init__(self, uuid, obj_dict=None):
self.virtual_machines = set()
self.params = None
self.state = 'init'
self.launch_count = 0
self.image = None
self.flavor = None
self.max_instances = 0
Expand Down
3 changes: 2 additions & 1 deletion src/config/svc-monitor/svc_monitor/svc_monitor.py
Expand Up @@ -696,6 +696,7 @@ def _create_service_instance(self, si):
st.virtualization_type)
except Exception:
cgitb_error_log(self)
si.launch_count += 1

def _delete_service_instance(self, vm):
self.logger.log_info("Deleting VM %s %s" %
Expand Down Expand Up @@ -766,7 +767,7 @@ def timer_callback(monitor):
si_id_list = list(ServiceInstanceSM._dict.keys())
for si_id in si_id_list:
si = ServiceInstanceSM.get(si_id)
if not si:
if not si or not si.launch_count:
continue
if not monitor._check_service_running(si):
monitor._relaunch_service_instance(si)
Expand Down

0 comments on commit 25b696d

Please sign in to comment.