realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.33k stars 2.15k forks source link

RLMProgressNotificationToken released without unregistering a notification. You must hold on to the RLMProgressNotificationToken and call -[RLMProgressNotificationToken invalidate] when you no longer wish to receive progress update notifications. #7831

Closed anton-plebanovich closed 2 years ago

anton-plebanovich commented 2 years ago

Description

The error is falsely produced when a session is released before invalidate for a token is called causing an inability to reset the _token value and so producing a misleading error message. On the screenshot is the proposed solution but I don't know the Realm source base good enough so it's up to you.

Version

10.27.0

ejm01 commented 2 years ago

Do you know what's causing the session to be released that makes you think the error falsely produced? That may be the issue. I think never having a progress_notifier exist whose token was released is intentional.

anton-plebanovich commented 2 years ago

Do you know what's causing the session to be released that makes you think the error falsely produced? That may be the issue. I think never having a progress_notifier exist whose token was released is intentional.

Well, I did what the warning says, I hold the token and then called invalidate when I no longer need it but still received the warning on the dealloc so I assumed it is missleading because I spent some time to investigate my logic while it was working fine.

This is happening on the App switch during ongoing load and overall is minor since there are no other issues.

ejm01 commented 2 years ago

What is the "App switch"? How are you storing the token? It sounds like you're able to reproduce reliably -- could you share a .zip so the team can check it out?

That'd be super helpful.

anton-plebanovich commented 2 years ago

It'll take some time to isolate the issue and create working example but I will try

anton-plebanovich commented 2 years ago

Please check the reproduction example here https://github.com/anton-plebanovich/SingleView/tree/realm/notification-token-bug