Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when unregistering remote push notifications on logout #24040

Closed
kean opened this issue Feb 3, 2025 · 3 comments · Fixed by #24041
Closed

Crash when unregistering remote push notifications on logout #24040

kean opened this issue Feb 3, 2025 · 3 comments · Fixed by #24041

Comments

@kean
Copy link
Contributor

kean commented Feb 3, 2025

Steps

  • On a physical device, tap "Me", "Logout" and confirm

Observed State

  • The app crashes
  • The app does not get unregistered from push notifications
@dangermattic
Copy link
Collaborator

dangermattic commented Feb 3, 2025

Thanks for reporting! 👍

@kean
Copy link
Contributor Author

kean commented Feb 3, 2025

RCA

  1. App calls [[PushNotificationsManager shared] unregisterDeviceToken];
  2. App synchronously deletes the account WPAccount and it calls [_wordPressComRestApi invalidateAndCancelTasks]; in prepareForDeletion
  3. (next run of the run loop) WordPressKit reaches the closure of Task { @MainActor in func POST. It tries to create a task on an invalidated session
@objc @discardableResult open func POST(_ URLString: String,
           parameters: [String: AnyObject]?,
           success: @escaping SuccessResponseBlock,
           failure: @escaping FailureReponseBlock) -> Progress? {
    Task { @MainActor in
        // URLSessionTask is created here, asynchronously 

@kean
Copy link
Contributor Author

kean commented Feb 4, 2025

Fixed in 25.7.1.

@kean kean closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants