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

[BUG] Android/tv-casting-app: NPEs #25463

Closed
sharadb-amazon opened this issue Mar 3, 2023 · 0 comments · Fixed by #25464
Closed

[BUG] Android/tv-casting-app: NPEs #25463

sharadb-amazon opened this issue Mar 3, 2023 · 0 comments · Fixed by #25464

Comments

@sharadb-amazon
Copy link
Contributor

Reproduction steps

  1. Make temporary changes to the Linux tv-app, so it does not advertise any device name in the DN TXT Record (can be done in Advertiser_ImplMinimalMdns.cpp)
  2. Discover the tv-app using the Android tv-casting-app.
  3. Observe NullPointerException in Stacktrace 1 below.

Also, stacktrace 2 and 3 have been observed in other testing.

Generally, the Android tv-casting-app needs some defensive checks to avoid these crashes.

Stacktrace 1 (NPE)

02-23 09:35:53.683 17414 17744 E AndroidRuntime: java.lang.NullPointerException: Attempt to get length of null array
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at java.lang.StringFactory.newStringFromBytes(StringFactory.java:101)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at com.chip.casting.DiscoveredNodeData.<init>(DiscoveredNodeData.java:54)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at com.chip.casting.NsdResolveListener.onServiceResolved(NsdResolveListener.java:67)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at android.net.nsd.NsdManager$ServiceHandler.handleMessage(NsdManager.java:456)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:226)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:313)
02-23 09:35:53.683 17414 17744 E AndroidRuntime: 	at android.os.HandlerThread.run(HandlerThread.java:67)

Stacktrace 2 (listener not registered)

ERROR: matter: Matter discovery failed. Error 3 (NsdDiscoveryListener Discovery failed to start: Nsd Error code:4).
--------- beginning of crash
02-24 14:42:30.189  4940  5330 E AndroidRuntime: FATAL EXCEPTION: NsdManager
02-24 14:42:30.189  4940  5330 E AndroidRuntime: PID: 4940
02-24 14:42:30.189  4940  5330 E AndroidRuntime: java.lang.IllegalArgumentException: listener not registered
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:59)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.net.nsd.NsdManager.getListenerKey(NsdManager.java:496)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.net.nsd.NsdManager.stopServiceDiscovery(NsdManager.java:636)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at com.chip.casting.NsdDiscoveryListener.onStartDiscoveryFailed(NsdDiscoveryListener.java:114)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.net.nsd.NsdManager$ServiceHandler.handleMessage(NsdManager.java:412)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
02-24 14:42:30.189  4940  5330 E AndroidRuntime: 	at android.os.HandlerThread.run(HandlerThread.java:67)

Stacktrace 3 (Multicast lock under-locked)

02-24 14:41:28.898  4940  5201 W System.err: java.lang.RuntimeException: MulticastLock under-locked chipMulticastLock
02-24 14:41:28.913  4940  5201 W System.err: 	at android.net.wifi.WifiManager$MulticastLock.release(WifiManager.java:6929)
02-24 14:41:28.913  4940  5201 W System.err: 	at chip.platform.NsdManagerServiceResolver.removeServices(NsdManagerServiceResolver.java:367)
02-24 14:41:28.913  4940  5201 W System.err: 	at com.chip.casting.TvCastingApp.openBasicCommissioningWindow(Native Method)

Bug prevalence

Every time with the above steps to repro

GitHub hash of the SDK that was being used

eff5773

Platform

android

Platform Version(s)

No response

Anything else?

No response

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