onSessionDestroyed callback can not be unregistered, causing a memory leak

(also posted in github zoom/videosdk-ui-toolkit-web issue #97.
Please go there for links and screenshots since this forum does not allow me to add them :man_shrugging: )

The onSessionDestroyed callback can not be unregistered, there is no offSessionDestroyed API in the uitoolkit SDK. While similar functions exist for join and close session event: offSessionJoined and offSessionClosed.

This causes the callback to be called twice the second time the uitoolkit is used, 3 times the third, and so on.

Applies all UI toolkit SDK releases (latest checked is version 2.3.0-2).

This memory leak can be easily observed in the zoom/videosdk-ui-toolkit-react-sample app, see screenshot:

  • removed screenshot

I have also created a test app based on nextjs to document bugs that are impacting our deployment, ref to github ercaronte/videosdk-ui-toolkit-nextjs-sample.
You can observe the same behavior there as well, see screenshot:

  • removed screenshot
1 Like

In addition to the missing offSessionDestroyed, the uitoolkit.destroy() could clear all registered callbacks.
That would simplify the user code and reduce the chances of leaks or misbehaviors.
What do you think?

1 Like

Hi @marcocarosi I reported this to the UIToolkit team and waiting for their response. In the meantime, are you able to refresh the page when you leave the session to release the callback as a temporary workaround?

Hi @ticorrian.heard , thank you for your feedback.
Yes refreshing the page does clear the status and all callbacks are released.

Knowing the issue I could come up with workarounds in our production app, so that multiple calls of the same function are not affecting the overall app status.

Thanks for confirming that @marcocarosi . I’m discussing with engineering now on a ETA for releasing a offSessionDestroyed callback or implementing additional teardown logic in the .destroy() method. I can keep you updated on the info here.

1 Like