[SDL-0117] Configurable time before shutdown #3740
[SDL-0117] Configurable time before shutdown #3740VladSemenyuk wants to merge 4 commits intosmartdevicelink:developfrom
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.
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.
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.
@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.
Yes, ExitAllApplicationsNotification is not the only exit point for SDL.
There was a problem hiding this comment.
@VladSemenyuk could you list what are other conditions or exit point to call logger Flush()?
There was a problem hiding this comment.
@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.
@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.
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.
@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.
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?
| LoggerSettings* settings_; | ||
| LoopThreadPtr<LogMessageLoopThread> loop_thread_; | ||
| bool use_message_loop_thread_; | ||
| TimePoint flush_logs_time_point_; |
There was a problem hiding this comment.
what's the default value of flush_logs_time_point_ if it is not initialized?
There was a problem hiding this comment.
Default constructor, creates a time_point representing the Clock's epoch (i.e., time_since_epoch() is zero).
| @@ -162,6 +162,7 @@ int32_t main(int32_t argc, char** argv) { | |||
| #endif // LOG4CXX_LOGGER | |||
There was a problem hiding this comment.
it is marked "not ready for review" in the PR summary , is that correct?
There was a problem hiding this comment.
This means the PR is not ready for the Project Maintainer review.
There was a problem hiding this comment.
@KhrystynaDubovyk got it, thank you
src/appMain/smartDeviceLink.ini
Outdated
| PeriodForConsentExpiration = 30 | ||
|
|
||
| [Logger] | ||
| ; Write all logs in queue to file system before shutdown |
There was a problem hiding this comment.
the comment "write all logs in queue" may not be correct, and it is misleading
| */ | ||
| bool flush_log_messages_before_shutdown() const OVERRIDE; | ||
| /** | ||
| * @brief Returns waximum time to wait for writing all data before exit SDL |
| const std::string hmi_origin_id() const OVERRIDE; | ||
|
|
||
| /** | ||
| * @brief Returns true if writing all logs to file system before shutdown is |
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