Skip to content

Commit

Permalink
Fixes InvalidSessionID when restarting ifmap
Browse files Browse the repository at this point in the history
This patch fixes an issue when the ifmap server
is restarted. In that case the svc_monitor gets
InvalidSessionID error from the newly ifmap connection
and starts to flood the ifmap server.

Closes-bug #1375696

Change-Id: Ibec3f7e1fe253c3a0e81ed812f028b302b986f3c
  • Loading branch information
Sylvain Afchain committed Oct 7, 2014
1 parent fdbc56a commit 3aa871f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/config/common/exceptions.py
Expand Up @@ -95,3 +95,8 @@ def __str__(self):

class AmbiguousParentError(VncError):
pass


class InvalidSessionID(VncError):
pass
# end InvalidSessionID
3 changes: 3 additions & 0 deletions src/config/common/imid.py
Expand Up @@ -8,6 +8,7 @@
import re
import StringIO
from lxml import etree
from cfgm_common import exceptions
from cfgm_common.ifmap.client import client
from ifmap.request import NewSessionRequest, RenewSessionRequest, \
EndSessionRequest, PublishRequest, SearchRequest, \
Expand Down Expand Up @@ -200,6 +201,8 @@ def parse_poll_result(poll_result_str):
namespaces=_XPATH_NAMESPACES)

if error_results:
if error_results[0].get('errorCode') == 'InvalidSessionID':
raise exceptions.InvalidSessionID(etree.tostring(error_results[0]))
raise Exception(etree.tostring(error_results[0]))

xpath_expr = '/a:Envelope/a:Body/b:response/pollResult'
Expand Down
11 changes: 8 additions & 3 deletions src/config/svc-monitor/svc_monitor/svc_monitor.py
Expand Up @@ -24,6 +24,7 @@
import logging
import logging.handlers

from cfgm_common import exceptions
from cfgm_common.imid import *
from cfgm_common import importutils
from cfgm_common import svc_info
Expand Down Expand Up @@ -505,16 +506,20 @@ def launch_arc(monitor, ssrc_mapc):
pollreq = PollRequest(arc_mapc.get_session_id())
result = arc_mapc.call('poll', pollreq)
monitor.process_poll_result(result)
except exceptions.InvalidSessionID:
cgitb_error_log(monitor)
return
except Exception as e:
if type(e) == socket.error:
time.sleep(3)
else:
cgitb_error_log(monitor)

def launch_ssrc(monitor):
ssrc_mapc = ssrc_initialize(monitor._args)
arc_glet = gevent.spawn(launch_arc, monitor, ssrc_mapc)
arc_glet.join()
while True:
ssrc_mapc = ssrc_initialize(monitor._args)
arc_glet = gevent.spawn(launch_arc, monitor, ssrc_mapc)
arc_glet.join()

def timer_callback(monitor):
si_list = monitor.db.service_instance_list()
Expand Down

0 comments on commit 3aa871f

Please sign in to comment.