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

Library stops working if StartSession(RPC) times out #1847

Closed
kshala-ford opened this issue Nov 10, 2020 · 2 comments
Closed

Library stops working if StartSession(RPC) times out #1847

kshala-ford opened this issue Nov 10, 2020 · 2 comments
Labels
bug A defect in the library manager-lifecycle Relating to the manager layer - lifecycle manager
Projects

Comments

@kshala-ford
Copy link
Contributor

Bug Report

In some cases the head unit takes more time to respond to StartService for RPC request and the library hits the timeout. See https://github.com/smartdevicelink/sdl_ios/blob/7.0.0/SmartDeviceLink/private/SDLLifecycleProtocolHandler.m#L86

This will cause the Protocol to close and end the transport.
https://github.com/smartdevicelink/sdl_ios/blob/7.0.0/SmartDeviceLink/private/SDLProtocol.m#L89
https://github.com/smartdevicelink/sdl_ios/blob/7.0.0/SmartDeviceLink/private/SDLIAPTransport.m#L218

In the transport class following code will be executed:

- (void)sdl_stopEventListening {
    SDLLogV(@"SDLIAPTransport stopped listening for events");
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

Because the disconnect/stop was called in lower levels but not in the manager, there is no restart method for the transport object. No component of sdl_ios is now listening to EAConnect notifications. As a result the app will never connect to any head unit until it's killed and restarted on the phone.

Reproduction Steps
  1. Install SDL Example on an iPhone
  2. Connect iPhone to a head unit
  3. Wait for the StartService timeout to occur
  4. Disconnect iPhone
  5. Reconnect iPhone
Expected Behavior

The app should try to connect again.

Observed Behavior

The app removed observer to EAConnect. It will never be able to connect to the head unit.

OS & Version Information
  • iOS Version: Any
  • SDL iOS Version: 7.0.0
  • Testing Against: SDL Example
Test Case, Sample Code, and / or Example App

The issue is more visible on SYNC3.0 if >20 apps are installed. It's possible to stop SDL Core on the SYNC3.0 to make it easier to reproduce/test. Details can be shared separately.

@kshala-ford
Copy link
Contributor Author

kshala-ford commented Nov 16, 2020

I tested some options and the change in the PR don't seem to work perfectly. I could spend more effort in refactoring some aspects of the iAP transport class. I also tested removing the timeout altogether and it did not only improve in the number of apps successfully connecting, it also eliminates this bug. removing the timeout should be a task in #1783 and closing this issue as not applicable anymore.

I would like to get some feedback by the PM if this approach is acceptable or if more effort should be done for the transport class. The question is why should we timeout if the protocol string itself gives confidence enough that the EA is an SDL device? the lib successfully tears down on EA disconnect even with timeout removed.

@joeljfischer joeljfischer added bug A defect in the library manager-lifecycle Relating to the manager layer - lifecycle manager labels Apr 14, 2021
@joeljfischer
Copy link
Contributor

Fixed by #1951

@joeljfischer joeljfischer added this to To do in v7.1.1 via automation May 24, 2021
@joeljfischer joeljfischer moved this from To do to Done in v7.1.1 May 24, 2021
@joeljfischer joeljfischer mentioned this issue May 24, 2021
1 task
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 manager-lifecycle Relating to the manager layer - lifecycle manager
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants