Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • S slixmpp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 37
    • Issues 37
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 10
    • Merge requests 10
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • poeziopoezio
  • slixmpp
  • Issues
  • #3442
Closed
Open
Issue created Oct 15, 2019 by ge0rg@ge0rgContributor

async IQ handlers need to be gracefully terminated on session destruction

Here's a rather hairy issue:

  1. a short network outage happens
  2. poezio notices and reconnects
  3. poezio stops working reliably, always losing connection, until I restart it manually

I always was assuming there is a race condition between multiple ongoing connection attempts, but maybe this is just an unlucky handler combination.

In ping.py, await is used to schedule a ping timeout on the connection. The only abort condition is IqTimeout. I've seen this handler, initiated by an old session, fire after poezio successfully reconnected and established a new session. This implies that the pending IQ timeout handler wasn't cancelled when the old session was terminated.

Therefore, we need some way to cancel all pending IQs when they are not sensible any more, e.g. by delivering a different type of exception (SessionClosed something) that can be ignored by the IQ sender. Something like this:

try:
    rtt = await self.ping(self.xmpp.boundjid.host, timeout=self.timeout)
except SessionClosed:
    log.debug("Old session is gone. No further action required.")    
except IqTimeout:
    log.debug("Did not receive ping back in time. " + \
              "Requesting Reconnect.")
    self.xmpp.reconnect(0.0, "Ping timeout after %ds" % self.timeout)
else:
    log.debug('Keepalive RTT: %s' % rtt)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking