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

Race condition causing NPE in SdlSession #736

Open
jthrun opened this issue Apr 13, 2018 · 0 comments
Open

Race condition causing NPE in SdlSession #736

jthrun opened this issue Apr 13, 2018 · 0 comments
Labels
bug A defect in the library protocol Relating to the protocol layer

Comments

@jthrun
Copy link

jthrun commented Apr 13, 2018

Bug Report

I have seen a case where code in SdlSession checks for a null SdlConnection object and if not null then sends a message but still results in NullPointerException. This seems like a race condition between the session sending a packet and the session being closed because the line right before the exception is a null check on the variable being used.
In my case, video was streaming when the session was being closed.

NPE location

04-13 16:05:46.490 32228   716 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.smartdevicelink.SdlConnection.SdlConnection.sendMessage(com.smartdevicelink.protocol.ProtocolMessage)' on a null object reference
04-13 16:05:46.490 32228   716 E AndroidRuntime:        at com.smartdevicelink.SdlConnection.SdlSession.sendMessage(SdlSession.java:496)
04-13 16:05:46.490 32228   716 E AndroidRuntime:        at com.smartdevicelink.SdlConnection.SdlSession.sendStreamPacket(SdlSession.java:388)
04-13 16:05:46.490 32228   716 E AndroidRuntime:        at com.smartdevicelink.streaming.video.RTPH264Packetizer.run(RTPH264Packetizer.java:244)
04-13 16:05:46.490 32228   716 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:818)
Reproduction Steps

Random

  • Cause SdlSession to close while it is on the verge of sending and RPC message
  • Timing is important
  • Terminate SDLCore/HMI at the correct time or block the BT (or other) connections between HU and HS
Expected Behavior

SdlProxyService should not crash

Observed Behavior

SdlProxyService crashes with NPE

OS & Version Information
  • Android Version: 5.0.1
  • SDL Android Version: 4.5 (develop branch)
  • Testing Against: in-house HU emulator with internal SDLCore build based on develop branch
Test Case, Sample Code, and / or Example App
@joeljfischer joeljfischer added bug A defect in the library protocol Relating to the protocol layer labels May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect in the library protocol Relating to the protocol layer
Projects
None yet
Development

No branches or pull requests

2 participants