-
Notifications
You must be signed in to change notification settings - Fork 244
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
Start the new PTU after a failed retry sequence #3208
Start the new PTU after a failed retry sequence #3208
Conversation
@ydementieiev please sign CLA |
@@ -1586,6 +1586,8 @@ class ApplicationManagerImpl | |||
|
|||
uint32_t apps_size_; | |||
|
|||
bool is_registered_in_timeout_; |
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.
@ydementieiev suggest to use atomic bool as timer might be in a data race with another thread
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.
@AKalinich-Luxoft done in fe7b393
#ifndef EXTERNAL_PROPRIETARY_MODE | ||
void OnPTUTimeOut() OVERRIDE; | ||
#endif | ||
void OnPTUTimeOut(); |
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.
@ydementieiev OVERRIDE?
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.
@AKalinich-Luxoft EXTERNAL_PROPRIETARY_MODE
build failed with OVERRIDE
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.
@ydementieiev then add pure virtual OnPTUTimeOut
into interface class for EXTERNAL_PROPRIETARY_MODE
/** | ||
* @brief Application queue ready for PTU | ||
*/ | ||
std::vector<uint32_t> queue_applications_for_ptu_; |
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.
@ydementieiev i think queue will be better container for your purposes
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.
@ydementieiev or even set as you want to keep only unique app id in your container
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.
@ydementieiev i think this container might need access synchronization
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.
@AKalinich-Luxoft used set and add AutoLock for work with this container in fe7b393
* with the same app_id | ||
* @param new_app_id app id new application | ||
*/ | ||
void AddNewApplicationIdToPTUQueue(const uint32_t new_app_id); |
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.
@ydementieiev can be renamed to PushAppIdToQueue
and PopAppIdFromQueue
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.
@AKalinich-Luxoft done in fe7b393
@@ -2205,6 +2233,15 @@ void PolicyHandler::OnAppsSearchCompleted(const bool trigger_ptu) { | |||
policy_manager_->OnAppsSearchCompleted(trigger_ptu); | |||
} | |||
|
|||
void PolicyHandler::OnAddedNewApplicationToAppList( | |||
const uint32_t new_app_id, const std::string policy_id) { |
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.
@ydementieiev nice to have auto trace here
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.
@AKalinich-Luxoft done in fe7b393
@@ -524,6 +524,12 @@ class PolicyManager : public usage_statistics::StatisticsManager, | |||
*/ | |||
virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0; | |||
|
|||
/** | |||
* @brief Change applicatios count ready for PTU |
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.
@ydementieiev typo
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.
@AKalinich-Luxoft done in fe7b393
@@ -608,6 +608,12 @@ class PolicyManagerImpl : public PolicyManager { | |||
*/ | |||
void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; | |||
|
|||
/** | |||
* @brief Change applicatios count ready for PTU |
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.
@ydementieiev typo
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.
@AKalinich-Luxoft done in fe7b393
@@ -1096,6 +1102,11 @@ class PolicyManagerImpl : public PolicyManager { | |||
bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table, | |||
policy_table::PolicyTableType type) const; | |||
|
|||
/** | |||
* @brief Check that application for PTU more than zero |
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.
* @brief Check that application for PTU more than zero | |
* @brief Check that new applications for PTU were registered |
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.
@AKalinich-Luxoft done in fe7b393
/** | ||
* @brief Count application ready for PTU | ||
*/ | ||
uint32_t count_application_; |
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.
uint32_t count_application_; | |
uint32_t applications_count_; |
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.
@ydementieiev @AKalinich-Luxoft i think name applications_pending_ptu_count_
would be more descriptive. Also, the doxygen description should be fixed accordingly
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.
@mked-luxoft renamed fe7b393
@@ -86,6 +86,11 @@ void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) { | |||
ProcessEvent(kOnUpdateSentOut); | |||
} | |||
|
|||
void UpdateStatusManager::OnUpdatePostponed() { | |||
LOG4CXX_AUTO_TRACE(logger_); | |||
ProcessEvent(kPostponedUpdate); |
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.
@ydementieiev consider using of SetPostponedStatus
- maybe you can use it instead of kPostponedUpdate
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.
@AKalinich-Luxoft I tried using SetPostponedStatus
but always find a new regression after. Now I renamed OnUpdatePostponed
to name which more describe what this method do, look please
* @param policy_id policy_id for this application | ||
*/ | ||
void OnAddedNewApplicationToAppList(const uint32_t new_app_id, | ||
const std::string policy_id) OVERRIDE; |
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.
this can be reference
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.
@mked-luxoft done fe7b393
@@ -410,6 +410,14 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { | |||
*/ | |||
virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0; | |||
|
|||
/** | |||
* @brief Notify that new applocation was added to application list |
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.
applocation
typo
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.
@mked-luxoft done fe7b393
/** | ||
* @brief Count application ready for PTU | ||
*/ | ||
uint32_t count_application_; |
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.
@ydementieiev @AKalinich-Luxoft i think name applications_pending_ptu_count_
would be more descriptive. Also, the doxygen description should be fixed accordingly
@@ -550,6 +555,10 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { | |||
|
|||
update_status_manager_.OnValidUpdateReceived(); | |||
|
|||
if (HasApplicationForPTU()) { |
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.
is this condition independent from ptu_result
?
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.
@mked-luxoft No, no matter what the ptu_result
will be from last update, we need set status to UPDATE_NEEDE for next ptu
/** | ||
* @brief Check that application for PTU more than zero | ||
*/ | ||
bool HasApplicationForPTU(); |
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.
i think this method can be const
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.
@mked-luxoft done fe7b393
, trigger_ptu_(false) {} | ||
, trigger_ptu_(false) | ||
, ptu_requested_(false) | ||
, last_registered_app_id_("") {} |
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.
is it policy_app_id
? if so, then i think that the variable's name should be changed accordingly
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.
@mked-luxoft done fe7b393
@@ -116,6 +118,10 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { | |||
return; | |||
} | |||
app_registered_from_non_consented_device_ = false; | |||
if (last_update_was_failed_) { | |||
last_update_was_failed_ = false; | |||
ProcessEvent(kPostponedUpdate); |
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.
are you sure that we still need to call ProcessEvent(kOnNewAppRegistered);
if we enter this condition?
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.
@mked-luxoft ProcessEvent(kPostponedUpdate)
added for extra call UPDATE_NEEDED
for new ptu if last was finished with the same status. I tried remove ProcessEvent(kOnNewAppRegistered)
but it entailed a lot of regressions
/** | ||
* @brief Application queue ready for PTU | ||
*/ | ||
std::vector<uint32_t> queue_applications_for_ptu_; |
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.
@ydementieiev i think this container might need access synchronization
@@ -598,13 +598,13 @@ class PolicyHandler : public PolicyHandlerInterface, | |||
* @param new_app_id app_id for this application | |||
* @param policy_id policy_id for this application | |||
*/ | |||
void OnAddedNewApplicationToAppList(const uint32_t new_app_id, | |||
const std::string policy_id) OVERRIDE; | |||
void OnAddedNewApplicationToAppList(const uint32_t& new_app_id, |
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.
@ydementieiev there is no need to pass int as a reference
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.
@AKalinich-Luxoft done f0f9ced
queue_applications_for_ptu_.size()); | ||
} | ||
sync_primitives::AutoLock lock(app_id_queue_lock_); | ||
queue_applications_for_ptu_.insert(app_id); |
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.
@ydementieiev check for return result of insert operation. If the same app_id is inserted, count will not be changed
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.
@AKalinich-Luxoft done f0f9ced
@@ -94,7 +94,7 @@ class UpdateStatusManager { | |||
/** | |||
* @brief Postponed update for PTU | |||
*/ | |||
void OnUpdatePostponed(); | |||
void OnUpdateForNextInQueue(); |
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.
@ydementieiev please update description
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.
@AKalinich-Luxoft done f0f9ced
#ifndef EXTERNAL_PROPRIETARY_MODE | ||
void OnPTUTimeOut() OVERRIDE; | ||
#endif | ||
void OnPTUTimeOut(); |
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.
@ydementieiev then add pure virtual OnPTUTimeOut
into interface class for EXTERNAL_PROPRIETARY_MODE
queue_applications_for_ptu_.insert(app_id); | ||
policy_manager_->OnChangeApplicationCount(queue_applications_for_ptu_.size()); | ||
std::pair<std::set<uint32_t>::iterator, bool> result; | ||
result = queue_applications_for_ptu_.insert(app_id); |
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.
@ydementieiev just
const auto result = queue_applications_for_ptu_.insert(app_id);
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.
@AKalinich-Luxoft done 1f93a08
@@ -660,6 +660,8 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { | |||
const std::string& policy_app_id, | |||
const std::string& hmi_level) = 0; | |||
|
|||
virtual void OnPTUTimeOut() = 0; |
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.
@ydementieiev please add a description
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.
@AKalinich-Luxoft done 1f93a08
@@ -183,9 +183,11 @@ class PolicyHandler : public PolicyHandlerInterface, | |||
const std::string& policy_app_id, | |||
const std::string& hmi_level) OVERRIDE; | |||
|
|||
#ifndef EXTERNAL_PROPRIETARY_MODE | |||
/** | |||
* @brief OnPTUTimeOut the callback which signals if PTU timeout occured |
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.
@ydementieiev Suggested changes here:
the callback which signals if PTU timeout occured
->the callback which is performed when PTU timeout occurred
- Move description to iface
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.
@AByzhynar update description c04c115ce
@@ -422,6 +424,18 @@ class PolicyHandler : public PolicyHandlerInterface, | |||
*/ | |||
uint32_t GetAppIdForSending() const OVERRIDE; | |||
|
|||
/** | |||
* @brief Add application to PTU queue if don't have application |
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.
@ydementieiev don't have application ...
-> no application with the same app id exists
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.
@AByzhynar update description c04c115ce
void PushAppIdToQueue(const uint32_t new_app_id); | ||
|
||
/** | ||
* @brief Remove first from queue application |
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.
@ydementieiev Remove the first application from applications queue
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.
@AByzhynar update description c04c115ce
* @param new_app_id app_id for this application | ||
* @param policy_id policy_id for this application | ||
*/ | ||
void OnAddedNewApplicationToAppList(const uint32_t new_app_id, |
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.
@ydementieiev Move description to iface
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.
@AByzhynar leaved description only in iface c04c115ce
const std::string& policy_id) OVERRIDE; | ||
|
||
/** | ||
* @brief Application queue ready for PTU |
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.
@ydementieiev What does it mean queue ready for PTU
?
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.
@AByzhynar update description c04c115ce
@@ -193,6 +193,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( | |||
this, &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties)) | |||
, is_low_voltage_(false) | |||
, apps_size_(0) | |||
, is_registered_in_timeout_(false) |
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.
@ydementieiev rename it according to the meaning please.
registered_during_timer_execution
or ...after_timer_expired
or ..before_expiration_timer_start_
, depends on the meaning
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.
@AByzhynar done c04c115ce
…occurs during the retry sequence
void PolicyHandler::OnAddedNewApplicationToAppList( | ||
const uint32_t new_app_id, const std::string& policy_id) { | ||
LOG4CXX_AUTO_TRACE(logger_); | ||
if (last_registered_policy_app_id_ == policy_id) { |
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.
@ydementieiev swap comparables please
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.
@AByzhynar swaped c04c115ce
@@ -91,6 +91,12 @@ class UpdateStatusManager { | |||
*/ | |||
void OnUpdateTimeoutOccurs(); | |||
|
|||
/** | |||
* @brief Update status for next in queue application | |||
* after previous has finished |
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.
- previous status or previous update?
- has finished -> has been finished or was finished
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.
@AByzhynar update description c04c115ce
…rigger occurs during the retry sequence
@@ -410,6 +410,14 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { | |||
*/ | |||
virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0; | |||
|
|||
/** | |||
* @brief Notify that new applocation was added to application list |
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.
@ydementieiev still typo...?
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.
@AByzhynar done d24d1e1e4f
/** | ||
* @brief Change applications count ready for PTU | ||
* @param new_app_count new applications count for PTU | ||
*/ |
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.
@ydementieiev Remove description form derived classes
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.
@AByzhynar done d24d1e1e4f
/** | ||
* @brief Change applications count ready for PTU | ||
* @param new_app_count new applications count for PTU | ||
*/ |
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.
@ydementieiev Same as above
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.
@AByzhynar done d24d1e1e4f
…rigger occurs during the retry sequence
@theresalech this PR passed internal Luxoft review and ready for Livio team review. |
src/components/application_manager/include/application_manager/policies/policy_handler.h
Outdated
Show resolved
Hide resolved
src/components/application_manager/include/application_manager/policies/policy_handler.h
Outdated
Show resolved
Hide resolved
src/components/application_manager/include/application_manager/policies/policy_handler.h
Outdated
Show resolved
Hide resolved
src/components/policy/policy_regular/include/policy/update_status_manager.h
Outdated
Show resolved
Hide resolved
src/components/include/policy/policy_external/policy/policy_manager.h
Outdated
Show resolved
Hide resolved
src/components/include/policy/policy_regular/policy/policy_manager.h
Outdated
Show resolved
Hide resolved
src/components/policy/policy_regular/src/policy_manager_impl.cc
Outdated
Show resolved
Hide resolved
…rigger occurs during the retry sequence
src/components/application_manager/include/application_manager/policies/policy_handler.h
Outdated
Show resolved
Hide resolved
… some trigger occurs during the retry sequence
@ShobhitAd Please notice scripts in #2318 were updated. |
@ShobhitAd Please notice all issues have been successfully fixed in ec86a40 and ready for review. |
@theresalech Please notice all comments in current PR in |
src/components/application_manager/src/policies/policy_handler.cc
Outdated
Show resolved
Hide resolved
src/components/application_manager/src/policies/policy_handler.cc
Outdated
Show resolved
Hide resolved
src/components/policy/policy_external/src/policy_manager_impl.cc
Outdated
Show resolved
Hide resolved
src/components/policy/policy_external/src/update_status_manager.cc
Outdated
Show resolved
Hide resolved
src/components/policy/policy_regular/src/policy_manager_impl.cc
Outdated
Show resolved
Hide resolved
@ydementieiev After following the steps in #3136 (registering a second app during the retry sequence for the first app), I see an issue where the First request:
All subsequent requests:
Note that I am testing with |
@ydementieiev @dboltovskyi do you have an update here? We would like to be able to review and merge this PR by the end of this week, so testing on Core 6.1 can begin. |
@theresalech Please notice we have identified one additional issue since last PM review. All updates are planned to be finished at |
@jacobkeeler Please find an explanation for the comment: #3208 (comment): We did some check using We have created an issue against |
@theresalech Please notice we made all planned updates in |
@jacobkeeler Please notice we resolved conflicts in |
Fixes #3136
This PR is [ready] for review.
Risk
This PR makes [no] API changes.
Summary
SDL should start the new PTU after a failed retry sequence in case some trigger occurs during the retry sequence.
Provided changes allow to perform the following actions:
CLA