-
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
[SDL-0117] Configurable time before shutdown #3740
base: develop
Are you sure you want to change the base?
[SDL-0117] Configurable time before shutdown #3740
Conversation
…hutdown. Update SDL config. Extend LoggerImpl class for shutdown configuration. Extend MessageLoopThread, MessageQueque and ConditionlVariable classes with new wait mechanism.
if (use_message_loop_thread_ && loop_thread_) { | ||
assert(settings_); | ||
|
||
if (0 == flush_logs_time_point_.time_since_epoch().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.
why do we have such a condition? it seems impossible to me that count() is zero, thus impossible to execute next line
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.
Default constructor, creates a time_point representing the Clock's epoch (i.e., time_since_epoch() is 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.
@VladSemenyuk in file on_exit_all_applications_notification.cc and function void OnExitAllApplicationsNotification::Run()
it calls SDL_INIT_FLUSH_LOGS_TIME_POINT(std::chrono::system_clock::now()); to set the value of flush_logs_time_point_ to non-zero, what's the condition that next line get executed? during the SDL running without receiving ExitAllApplicationsNotification?
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.
Yes, ExitAllApplicationsNotification is not the only exit point for SDL.
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.
@VladSemenyuk could you list what are other conditions or exit point to call logger Flush()?
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.
@yang1070 The proposal is old and at the time it was written the logger worked differently, and now it does`nt match the proposal. So before this implementation SDL flushed all logs always on logger deinitialization, and now configurable timeout shutdown for IGNITION_OFF situation is added.
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.
@VladSemenyuk in that case I'm not sure the proposal is still valid and whether or not we need this change.
the proposal solves the problem that SDL drops off log and give options to continue write the log with maximum allowed time configured by the SDL settings in ini file.
Now (before this PR), SDL get some update, it always flush the log, SDL no long drop off the log, the old problem does not exist any more. The problem may change to SDL takes too much time for flushing the logs? Why we still need to implement the proposal?
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.
The problem may change to SDL takes too much time for flushing the logs? Why we still need to implement the proposal?
@yang1070 Yes. Problem is it takes too much time for flushing the logs in some cases on weak environment.
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.
@VladSemenyuk in that case, I would like to see an update of SDL-117 and get the update proposal approved first
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.
since the default SDL behavior is to flush log,
as in the code change, the setting FlushLogMessagesBeforeShutdown
will only impact the normal IGNITION_OFF situation. the name shall be change to something else that is more proper and can describe the situation
or if the name does not change, shall FlushLogMessagesBeforeShutdown
=false to force SDL drop off log no matter the what the exit point is?
LoopThreadPtr<LogMessageLoopThread> loop_thread_; | ||
bool use_message_loop_thread_; | ||
TimePoint flush_logs_time_point_; |
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.
what's the default value of flush_logs_time_point_ if it is not initialized?
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.
Default constructor, creates a time_point representing the Clock's epoch (i.e., time_since_epoch() is 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.
@VladSemenyuk Got it. Thank you
@@ -162,6 +162,7 @@ int32_t main(int32_t argc, char** argv) { | |||
#endif // LOG4CXX_LOGGER |
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 is marked "not ready for review" in the PR summary , is that correct?
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 means the PR is not ready for the Project Maintainer review.
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.
@KhrystynaDubovyk got it, thank you
src/appMain/smartDeviceLink.ini
Outdated
@@ -411,3 +411,9 @@ RpcPassThroughTimeout = 10000 | |||
[RCModuleConsent] | |||
; The period (in days) after which consent for module_id should be removed. | |||
PeriodForConsentExpiration = 30 | |||
|
|||
[Logger] | |||
; Write all logs in queue to file system before shutdown |
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.
the comment "write all logs in queue" may not be correct, and it is misleading
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.
Fixed
*/ | ||
bool flush_log_messages_before_shutdown() const OVERRIDE; | ||
/** | ||
* @brief Returns waximum time to wait for writing all data before exit SDL |
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.
typo waximum
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.
@yang1070 Done
@@ -589,6 +591,18 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, | |||
|
|||
const std::vector<std::string>& embedded_services() const OVERRIDE; | |||
const std::string hmi_origin_id() const OVERRIDE; | |||
|
|||
/** | |||
* @brief Returns true if writing all logs to file system before shutdown is |
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.
please remove "all" in comment
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.
@yang1070 Done
Implements #1941
This PR is not ready for review.
Risk
This PR makes no API changes.
Testing Plan
ATF scripts
Summary
Add Logger config settings with params for configurable time before shutdown.
Update SDL config.
Extend LoggerImpl class for shutdown configuration.
Extend MessageLoopThread, MessageQueque and ConditionlVariable classes with new wait mechanism.
CLA