Skip to content

Potential Deadlock #3545

@tunds

Description

@tunds

Summary

I've noticed that we have some scenarios when using the Apollo GraphQL subscriptions can deadlock when attempting to reconnect due to network disruptions. We have noticed this can happen quite often when we are using our internal VPN (GlobalProtect) if there is a disconnect and the subscriptions attempt to reconnect the application will freeze.

When inspecting what is going on the main thread this function seems to be potentially causing the app to hang.

  public func connect() {
    serialQueue.sync {
      guard !self.isConnecting else { return }
      self.didDisconnect = false
      self.isConnecting = true
      self.createHTTPRequest()
    }
  }

This all starts from the attemptReconnectionIfDesired function.

Version

1.17.0

Steps to reproduce the behavior

  1. Run app on a simulator to real device
  2. Cause a disconnect i.e. from VPN moving between networks
  3. Cause SDK to attempt a reconnect
  4. Observe that the reconnect causes a hang

Logs

Anything else?

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions