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

[SDL-0189] Restructuring OnResetTimeout #3726

Merged

Conversation

ychernysheva
Copy link
Contributor

Fixes #2422
Also fixes known issue #2829

This PR is ready for review.

Risk

This PR makes major API changes.

Testing Plan

  • Unit testing.
  • ATF testing.

Summary

Expand OnResetTimeout RPC for all interfaces.
Note: SDL will apply OnResetTimeout only in case when resetPeriod value is greater than the time remaining from the current timeout

Changelog

Breaking Changes
  • Remove deprecated functionality
  • Add Reset Timeout Handler
  • Create Request Controller interface

CLA

Copy link

@atiwari9 atiwari9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, i have left some review comments. Also, can you please confirm if BC.OnResetTimeout is applicable to all RPCs including Alert, DialNumber, SubtleAlert etc.? Or do we have specific requirements barring that? I noticed that there are some tests in atf test scripts designed to ignore OnResetTimeout for these RPCs.

* requests.
*/
class RequestController {
class RequestControllerImpl : public RequestController {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add all the deleted comments as applicable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atiwari9 please note that RequestControllerImpl is now just a class containing public functions overridden from the interface class. We don't need to duplicate the description of such functions in the impl classes according to our coding style:
https://google.github.io/styleguide/cppguide.html#Function_Comments

When documenting function overrides, focus on the specifics of the override itself, rather than repeating the comment from the overridden function. In many of these cases, the override needs no additional documentation and thus no comment is required.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft , @ychernysheva - Please let me know when the PR is ready to be reviewed after above mentioned changes.

@@ -45,7 +45,10 @@ RCGetInteriorVehicleDataConsentRequest::RCGetInteriorVehicleDataConsentRequest(
params.application_manager_,
params.rpc_service_,
params.hmi_capabilities_,
params.policy_handler_) {}
params.policy_handler_) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be read from smartDeviceLink.ini config file. Why is this timeout doubled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atiwari9
Yes, initially default timeout value is taken from the SDL config file for all command requests:

, default_timeout_(application_manager.get_settings().default_timeout())

Later, some particular commands are adjusting the default timeout according to their internal needs.
In this case, timeout is doubled to give HMI extra time for showing user consent prompt popup (which is another +10 seconds) - please look at linked issue #2829 for more details and sequence diagram.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this may have been used as a work around earlier, when HMI probably didn't have a way to reset the timeout on SDL side, now it does. So we really don't and shouldn't still add such patches in SDL. If this is done to maintain the legacy implementation, i understand. But even in that case please log a bug/improvement item so that the onus can now be shifted back to HMI. After all, that's the whole point of enabling HMI to reset timeout for RPCs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atiwari9 ok, I think we can remove all these timeout adjustments from existing PR and rely on HMI to control the lifetime of corresponding requests properly. In that case, we need the following changes:

  1. Remove timeout adjustment changes from affected SDL core requests
  2. Update the same requests on the HMI side - if HMI notices that extra time from the user is required then HMI sends OnResetTimeout to SDL with a doubled timeout value so SDL can wait for enough time
  3. Check with ATF scripts that updated implementation does not break the legacy code and feature works as expected

Please let me know, is that plan works for you?

@@ -54,6 +54,21 @@ ButtonPressRequest::ButtonPressRequest(

ButtonPressRequest::~ButtonPressRequest() {}

bool ButtonPressRequest::Init() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this should be HMI's responsibility. Why are we changing timeout in SDL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atiwari9
SDL should understand from its side whether the mobile request expired (and respond with GENERIC_ERROR) or HMI is still working on it. The reason for changing the timeout is the same as in the previous comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comment: #3726 (comment)

@@ -54,6 +54,22 @@ SetInteriorVehicleDataRequest::SetInteriorVehicleDataRequest(

SetInteriorVehicleDataRequest::~SetInteriorVehicleDataRequest() {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above. this should be HMI's responsibility. Why are we changing timeout in SDL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atiwari9
SDL should understand from its side whether the mobile request expired (and respond with GENERIC_ERROR) or HMI is still working on it. The reason for changing the timeout is the same as in the previous comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft
Copy link
Contributor

Thanks for the PR, i have left some review comments. Also, can you please confirm if BC.OnResetTimeout is applicable to all RPCs including Alert, DialNumber, SubtleAlert etc.? Or do we have specific requirements barring that? I noticed that there are some tests in atf test scripts designed to ignore OnResetTimeout for these RPCs.

@atiwari9 it's hard to simply say yes or no here. Basically, BC.OnResetTimeout is applicable to all RPCs until some specific requirement blocks that. For example, we have a requirement that timeout reset can't be applied to DialNumber. Also, we have a requirement that timeout is not applicable to Alert/SubtleAlert in case if these requests contain soft buttons and so on...

More details and references will be provided for all these requirements in atf test scripts PR

@atiwari9
Copy link

@ychernysheva - Also can you please log a bug for the case where Alert response is still ABORTED when TTS.Alert timeout is reset and UI.Alert finishes. Ideally it should wait for both UI and TTS Alert timeouts to be complete.

@AKalinich-Luxoft
Copy link
Contributor

@ychernysheva - Also can you please log a bug for the case where Alert response is still ABORTED when TTS.Alert timeout is reset and UI.Alert finishes. Ideally it should wait for both UI and TTS Alert timeouts to be complete.

@atiwari9 I don't think this is a bug. It's a part of the existing SDL logic - in case if SDL receives a response from HMI on the UI part but the TTS part is still in progress, then SDL sends TTS.StopSpeaking to abort the TTS part, waits for HMI to abort TTS, and then responds with ABORTED code.
Implementation of the possibility to reset timeout for the TTS part only allows reproducing the case when TTS response is received after the UI part (however ideally TTS response should be received before UI part).
In other words, I don't think SDL should wait for both UI and TTS - response to the UI part is sufficient

@atiwari9
Copy link

@ychernysheva - Also can you please log a bug for the case where Alert response is still ABORTED when TTS.Alert timeout is reset and UI.Alert finishes. Ideally it should wait for both UI and TTS Alert timeouts to be complete.

@atiwari9 I don't think this is a bug. It's a part of the existing SDL logic - in case if SDL receives a response from HMI on the UI part but the TTS part is still in progress, then SDL sends TTS.StopSpeaking to abort the TTS part, waits for HMI to abort TTS, and then responds with ABORTED code.
Implementation of the possibility to reset timeout for the TTS part only allows reproducing the case when TTS response is received after the UI part (however ideally TTS response should be received before UI part).
In other words, I don't think SDL should wait for both UI and TTS - response to the UI part is sufficient

Thinking further on it, i think the scenario where user has dismissed the Alert while TTS was playing does count as ABORTED, so it is fine. Though i am strongly for HMI to manage that instead of putting it on SDL. SDL should not determine the user experience HMI wants for its users, hence i am usually not a proponent of SDL side workarounds/patches as it creates a hard dependency. But since this is legacy implementation, we can let this particular case slide.

* Do not manage requests with NULL timeout
@AKalinich-Luxoft
Copy link
Contributor

@atiwari9 core changes according to comment #3726 (comment) have been added in f27c548 and fd71265

Copy link

@atiwari9 atiwari9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aprproved.

@LitvinenkoIra
Copy link
Contributor

@theresalech This PR is ready for Livio review. Thank you!

@AKalinich-Luxoft
Copy link
Contributor

@ShobhitAd all comments have been processed. Could you please proceed with your review here?

@iCollin
Copy link
Collaborator

iCollin commented Jul 28, 2021

@AKalinich-Luxoft Hello,

With these changes OnResetTimeout with no resetPeriod specified will set the timeout equal to the defaultTimeout from the ini. Previously, the HMI requesting a ResetTimeout would set the timeout to a command's modified default_timeout_ property, which is greater than defaultTimeout. Because of this change, if the HMIs now send a TIMEOUT message after the defaultTimeout, Core will have sent mobile a GENERIC_ERROR response before the HMI's response can be processed, resulting in Mobile not receiving responses it should.

In order to handle the time the message spends on the wire (in transport), in a message queue, and finally being processed I propose we add some additional time to these timers, ideally configurable from the INI.

At the moment these TIMEOUT responses can be received by mobile because the HMI is decrementing all incoming timeouts by 1000ms, which will be removed.

Update default timeout logic accordingly
for all commands. Added new file to ini file.
@AKalinich-Luxoft
Copy link
Contributor

@AKalinich-Luxoft Hello,

With these changes OnResetTimeout with no resetPeriod specified will set the timeout equal to the defaultTimeout from the ini. Previously, the HMI requesting a ResetTimeout would set the timeout to a command's modified default_timeout_ property, which is greater than defaultTimeout. Because of this change, if the HMIs now send a TIMEOUT message after the defaultTimeout, Core will have sent mobile a GENERIC_ERROR response before the HMI's response can be processed, resulting in Mobile not receiving responses it should.

In order to handle the time the message spends on the wire (in transport), in a message queue, and finally being processed I propose we add some additional time to these timers, ideally configurable from the INI.

At the moment these TIMEOUT responses can be received by mobile because the HMI is decrementing all incoming timeouts by 1000ms, which will be removed.

@iCollin all changes have been implemented in 031c65f
We added a default timeout compensation param to ini file which is defaulted to 1000ms.
This timeout compensation is applied to all commands timeouts initially and also applied after OnResetTimeout notification.
All affected unit tests were updated accordingly.

@ShobhitAd
Copy link
Contributor

@AKalinich-Luxoft thank you for addressing the review comments. Please resolve the merge conflicts on the PR

@AKalinich-Luxoft
Copy link
Contributor

@AKalinich-Luxoft thank you for addressing the review comments. Please resolve the merge conflicts on the PR

@ShobhitAd done

@ShobhitAd
Copy link
Contributor

ShobhitAd commented Aug 6, 2021

@AKalinich-Luxoft a small comment regarding the rpc_spec commit change.
It looks like the rpc_spec commit used in the PR is smartdevicelink/rpc_spec@d4990d8 but the latest rpc_spec commit for develop is smartdevicelink/rpc_spec@12c2d1d
Could you update the rpc_spec submodule commit in the PR to point to the latest commit on rpc_spec develop

@AKalinich-Luxoft
Copy link
Contributor

@ShobhitAd fixed in c011a9c
Sorry, forgot to fetch this repo

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

Successfully merging this pull request may close these issues.

9 participants