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

Android app crashes on session disconnected #175

Closed
geweald opened this issue Sep 24, 2018 · 4 comments
Closed

Android app crashes on session disconnected #175

geweald opened this issue Sep 24, 2018 · 4 comments

Comments

@geweald
Copy link

geweald commented Sep 24, 2018

Bug Report

What is the current bug behavior?
App crashes on session disconnected on Android when we force disconnect user from the session and he was also in this session before. It seems like the session isn't closing and doesn't clear its callbacks. The sessionConnected event fires every time user joins the session, but sessionDisconnected fires only when we force close the session/disconnect all users.

My temporary solution is: #176 but it doesn't feel good.

Steps to reproduce
Set sessionDisconnected event handler on OTSession component, join video chat and force disconnect users from the session
Doesn't matter whether even handler is set.

  1. Join an existing video chat session and then leave the session (unmount component) - if sessionDisconnected event handler is set it doesn't fire.
  2. Join again this session and then force disconnect user from this session (somehow in the backend or whatever).
  3. App crashes

What is the expected correct behavior?
App shouldn't crash.

Relevant logs and/or screenshots

Fatal Exception: java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
       at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:28)
       at com.opentokreactnative.OTSessionManager.onDisconnected(OTSessionManager.java:484)
       at com.opentok.android.Session.onDisconnected(Session.java:1605)
       at com.opentok.android.Session$5.run(Session.java:1566)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:7000)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
@Artemnsk
Copy link

Maybe something similar on iOS but sessionDisconnected simply not executed?
That's what I did for testing. In my "root" App.js file I set up native events like this:

constructor(props) {
  super(props)
  const sessionEvents = sanitizeSessionEvents({
    sessionDisconnected: (session, a, b) => {
      // Never executed!
    },
    sessionConnected: (session, a, b) => {
      // Executed as expected.
    },
    // ... other event handlers that work fine.
  })
  setNativeEvents(sessionEvents)
}

.. And I commented removeNativeEvents(...) execution in componentWillUnmount() of OTSession component. Thus, OT.disconnectSession() still run but I do not remove event handlers any more to be 100% sure I executed sessionDisconnected() declared in App.js.

However sessionDisconnected never run. But sessionConnected() as well as any other event handlers declared in App.js executed fine.

@geweald
Copy link
Author

geweald commented Nov 15, 2018

Still happening in v0.9

@msach22
Copy link
Contributor

msach22 commented Dec 20, 2018

@selcute @Artemnsk I have a fix for the crash and the sessionDisconnected event - I will patch this by tomorrow.

@msach22 msach22 mentioned this issue Dec 21, 2018
2 tasks
msach22 pushed a commit that referenced this issue Dec 21, 2018
@msach22
Copy link
Contributor

msach22 commented Dec 21, 2018

The fix for this has been released with v0.9.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants