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-0117] Configurable time before shutdown #3740

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

VladSemenyuk
Copy link
Contributor

@VladSemenyuk VladSemenyuk commented Jul 19, 2021

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

…hutdown. Update SDL config.

Extend LoggerImpl class for shutdown configuration.
Extend MessageLoopThread, MessageQueque and ConditionlVariable classes with new wait mechanism.
@dboltovskyi dboltovskyi changed the title Configurable time before shutdown [SDL-0117] Configurable time before shutdown Jul 23, 2021
if (use_message_loop_thread_ && loop_thread_) {
assert(settings_);

if (0 == flush_logs_time_point_.time_since_epoch().count()) {

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

Copy link
Contributor Author

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).

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?

Copy link
Contributor Author

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.

Copy link

@yang1070 yang1070 Jul 27, 2021

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()?

Copy link
Contributor Author

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.

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?

Copy link
Contributor Author

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.

Copy link

@yang1070 yang1070 Jul 27, 2021

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

Copy link

@yang1070 yang1070 Jul 27, 2021

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_;

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?

Copy link
Contributor Author

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).

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

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?

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.

Copy link

@yang1070 yang1070 Jul 27, 2021

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

@@ -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

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

Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

typo waximum

Copy link
Contributor Author

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yang1070 Done

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.

None yet

4 participants