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

VNCConnService race crashes #172

Closed
bk138 opened this issue Nov 16, 2021 · 6 comments
Closed

VNCConnService race crashes #172

bk138 opened this issue Nov 16, 2021 · 6 comments

Comments

@bk138
Copy link
Owner

bk138 commented Nov 16, 2021

VNCConnService is still racy, sometimes NullpointerExceptions can occur.

Reported backtraces are not really helpful:

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:4657)
  at android.app.ActivityThread.access$2000 (ActivityThread.java:247)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2091)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7838)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
Caused by: java.lang.NullPointerException: 
  at com.coboltforge.dontmind.multivnc.VNCConnService.onStartCommand (VNCConnService.kt:2)
  at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:4639)
  at android.app.ActivityThread.access$2000 (ActivityThread.java:247)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2091)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7838)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)

Theories

  • What about register call A, startService call A, deregister call B, onStartCommand call A? -> mConnectionList will be empty, OK
@bk138 bk138 self-assigned this Nov 16, 2021
bk138 added a commit that referenced this issue Nov 23, 2021
bk138 added a commit that referenced this issue Nov 23, 2021
bk138 added a commit that referenced this issue Nov 23, 2021
@bk138
Copy link
Owner Author

bk138 commented Nov 26, 2021

@gujjwal00
Copy link
Contributor

One issue might be the data type for intent parameter:

override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {

Because Intent is used instead of Intent?, Kotlin compiler will automatically insert a null-check here. But intent parameter can be null for onStartCommand().

@bk138
Copy link
Owner Author

bk138 commented Nov 26, 2021

One issue might be the data type for intent parameter:

override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {

Because Intent is used instead of Intent?, Kotlin compiler will automatically insert a null-check here. But intent parameter can be null for onStartCommand().

You mean that's the reason it reports line 2 deep from the bowels of Kotlin instead of the line of onStartCommand()?

bk138 added a commit that referenced this issue Nov 26, 2021
re #172

And most specifically #172 (comment)
which states "Because Intent is used instead of Intent?, Kotlin compiler will automatically
insert a null-check here. But intent parameter can be null for onStartCommand()."
bk138 added a commit that referenced this issue Nov 26, 2021
re #172

And most specifically #172 (comment)
which states "Because Intent is used instead of Intent?, Kotlin compiler will automatically
insert a null-check here. But intent parameter can be null for onStartCommand()."
@gujjwal00
Copy link
Contributor

It might be.
When I do (new VNCConnService()).onStartCommand(null, 0, 0); from any Java file, resulting exception has line number 2 but the message clearly states which argument is null. Ex:

2021-11-26 19:21:24.638 31624-31672/com.coboltforge.dontmind.multivnc E/AndroidRuntime: FATAL EXCEPTION: Thread-6
    Process: com.coboltforge.dontmind.multivnc, PID: 31624
    java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter intent
        at com.coboltforge.dontmind.multivnc.VNCConnService.onStartCommand(Unknown Source:2)
        at com.coboltforge.dontmind.multivnc.VNCConn$ServerToClientThread.run(VNCConn.java:267)

@bk138
Copy link
Owner Author

bk138 commented Nov 26, 2021

Yeah those details are ommited by the Goog Play stack trace above 🙄

@bk138
Copy link
Owner Author

bk138 commented Dec 1, 2021

No more reports incoming on Google Play, I rule this issue closed 🔨

@bk138 bk138 closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants