realm-swift icon indicating copy to clipboard operation
realm-swift copied to clipboard

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.

Open anton-plebanovich opened this issue 2 years ago • 5 comments

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. image

Version

10.27.0

anton-plebanovich avatar Jun 08 '22 03:06 anton-plebanovich

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.

ericjordanmossman avatar Jun 13 '22 18:06 ericjordanmossman

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.

anton-plebanovich avatar Jun 13 '22 20:06 anton-plebanovich

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.

ericjordanmossman avatar Jun 16 '22 19:06 ericjordanmossman

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

anton-plebanovich avatar Jun 16 '22 19:06 anton-plebanovich

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

anton-plebanovich avatar Jun 16 '22 20:06 anton-plebanovich