-
Notifications
You must be signed in to change notification settings - Fork 243
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
Fix SDL behavior during low voltage #3029
Conversation
@theresalech PR is ready for Livio team review. Thank you. |
@theresalech Please notice there is an update in scripts related to the issue which needs to be taken into account as well: smartdevicelink/sdl_atf_test_scripts#2261 |
There is quite a bit of duplicated code in this PR. It would be more maintainable to add a parameter to existing functions in Transport Manager, Transport Adapter and TCP Client Listener that determines the functionality than to have these duplicate functions.
While shutting down sockets was added in this PR, the TCP Client Listener thread will be joined in both current version and this branch. In fact, this PR removes the joining of the Interface Listener thread which is happening currently. |
@iCollin Please check the reply. Thank you.
Sure. You are right. We will try to combine duplicated code into functions.
This was made intentionally as all the threads will be suspended during Low Voltage and all we need to do is just shutdown and close appropriate sockets and re-create them on WakeUp. So when the thread will be woken up - it will use new socket. |
@AByzhynar please let us know when this is ready for re-review |
@theresalech PR is ready for re-review |
@iCollin Please don't merge after approval. I would like to squash commits to make history clear and understandable. Just |
I will squash and merge after I approve this PR, should get around to review in a few hours. |
Ok. Thank you. We have checked all unit tests as well as all regression tests. |
} else { | ||
ret = (*it)->StopClientListening(); | ||
} | ||
(*it)->ChangeClientListening(required_action); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(*it)->ChangeClientListening(required_action); | |
ret = (*it)->ChangeClientListening(required_action); |
There were found a several problems during SDL testing with ATF scripts: 1. SDL does not ignore messages from mobile/HMI during low voltage and processes them on wake up 2. Sometimes SDL ignores messages on wake up due to timings 3. SDL low voltage process is not stopping properly by exit() function 4. SDL does not send OnAppUnregistered after wake up to HMI To solve mentioned problems, the following changes were done: 1. exit() was replaced with _Exit() which allow to force close the process 2. Suspend transport events processing threads during low voltage, such as unexpected disconnect etc. These events should be processed when SDL wakes up completely. 3. Suspend all client listening threads and shut down sockets for a TCP connections to prevent any possibility to receive message during low voltage. These threads will be resumed on wake up. 4. Set low_voltage flag to false in the end of wakeup() function to prevent any timing issues. 5. Don't add pending requests/notifications into request controller if low voltage event has happened, as it may happen at any moment 6. Don't handle received pending messages from mobile/HMI in RPC handler if low voltage event has happened as it may happen at any moment 7. Updated logic of few test case scenarios. Updated unit tests according to code changes
107b8ad
to
8c71bbb
Compare
} | ||
TransportAdapter::Error ret = TransportAdapter::Error::UNKNOWN; | ||
|
||
for (auto adapter_ptr : transport_adapters_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iCollin I have updated the code and make it even more short and simple
TransportAdapter::Error ret = TransportAdapter::Error::UNKNOWN; | ||
|
||
for (auto adapter_ptr : transport_adapters_) { | ||
ret = adapter_ptr->ChangeClientListening(required_action); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iCollin as well as here
We would appreciate if you did not force push on sdl_core repository. It makes it difficult to review a PR because we cannot tell what was changed since the last review. In general, please do not rebase, do not force push against sdl_core. Instead, you can merge the current develop branch into your PR branch. Please pass this information along to your team members. Thank you |
Fixes #2996
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Covered by ATF test scripts
Summary
There were found a several problems during SDL testing with ATF scripts:
To solve mentioned problems, the following changes were done:
exit()
was replaced with_Exit()
which allow to force close the child process which has fully done its job.low_voltage
flag to false in the end ofwakeup()
function to prevent any timing issues.CLA