openid / openid/AppAuth-iOS

Crash when sending message to deallocated instance

Open
#709 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
2k
Forks
867
Avg merge
4d 48m
Merged PRs (30d)
1

Description

Describe the bug
Users are reporting a crash where a release message is being sent to an SFAuthenticationSession object that has already been deallocated.

To Reproduce
Steps to reproduce the behavior:

  1. Start an authorization session by calling OIDAuthState.authState(byPresenting:presenting). The call presents an SFSafariViewController.
  2. Grant permission to sign in using the system dialog that appears.
  3. Move the app to the background.
  4. Go to Settings > Safari > Clear History and Website Data.
  5. Go into the app again. A new permission dialog is shown.
  6. Tap Cancel. The view controller starts dismissing but crashes shortly after.

The same problem occurs when moving the app to the background and using enough other apps for the memory to be reclaimed. Step 4 could therefore be replaced with "Use a bunch of other apps".

Expected behavior
I would expect the presented view controller to dismiss and let the user continue from the presenting screen.

Environment

  • Device: iPhone 12 and iPhone simulators
  • OS: iOS 14.2 and iOS 15.5
  • AppAuth version: 1.4.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the authorization flow with OIDAuthState.authState(byPresenting:presenting), then inspect how the SFAuthenticationSession lifecycle is handled when the app returns from the background and cancellation begins. Done means the view controller dismisses without sending a release message to a deallocated instance and returns to the presenting screen.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
authentication, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.