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 crash during cleanup. #2621

Merged

Conversation

mkorniichuk
Copy link
Contributor

@mkorniichuk mkorniichuk commented Sep 19, 2018

Fixes #2428 #1829

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

Manually tested

Summary

If resumption_storage_ in ResumeCtrlImpl is failed to initialize,
SDL will try to stop components and exit with error code.
At this time application manager tries to unregister all applications and
call ResumeCtrlImpl::OnIgnitionOff() where resumption_storage_ is used. As a result, a crash will occur.

As an example, if AppStorageFolder have no read/write access, resumption_storage_
fails to initialize.

CLA

If resumption_storage_ in ResumeCtrlImpl is failed to initialize,
SDL will try to stop components and exit with error code.
At this time application manager tries to unregister all applications and
call ResumeCtrlImpl::OnIgnitionOff() where resumption_storage_ is used. As a result, a crash will occur.

As an example, if AppStorageFolder have no read/write access, resumption_storage_
fails to initialize.
@@ -336,6 +336,10 @@ void ResumeCtrlImpl::OnSuspend() {
void ResumeCtrlImpl::OnIgnitionOff() {
LOG4CXX_AUTO_TRACE(logger_);
if (!application_manager_.IsLowVoltage()) {
if (!resumption_storage_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@mkorniichuk do we have case if resumption storage may be nit initialized? If no> I would put DCHECK here

Copy link
Contributor

Choose a reason for hiding this comment

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

@mkorniichuk in case if FS is read only, it should be handled inside resumption storage, isn't it? Or even in Last state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LuxoftAKutsan DCHECK will stop application immediately with logged fatal error. But we still need to stop all components, don't we?
About the FS. It is handled in application manager Init(). So the Init() of resumption_storage is not even called. Then StopComponents takes place, where Stop method is called for application manager, and so the OnIgnitonOff method of ResumptionController is called as well. And since resumption_storage is not initialized, a crash will occur.

Copy link
Contributor

Choose a reason for hiding this comment

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

DCHECK is assertion. Assertion will be removed from release build. During testing if we found such condition, we can just crash SDL with appropriate information.

Comment on lines 339 to 342
if (!resumption_storage_) {
LOG4CXX_ERROR(logger_, "resumption_storage_ is not initialized");
return;
}

This comment was marked as outdated.

@jacobkeeler jacobkeeler dismissed their stale review May 8, 2020 15:16

Applied changes

@jacobkeeler jacobkeeler merged commit 4f82834 into develop May 8, 2020
@jacobkeeler jacobkeeler deleted the fix/SDL_crash_during_cleanup_if_storage_not_initialized branch May 8, 2020 15:20
ydementieiev pushed a commit to LuxoftSDL/sdl_core that referenced this pull request May 18, 2020
* SDL crash during StopComponents() if StartComponents() failed.

If resumption_storage_ in ResumeCtrlImpl is failed to initialize,
SDL will try to stop components and exit with error code.
At this time application manager tries to unregister all applications and
call ResumeCtrlImpl::OnIgnitionOff() where resumption_storage_ is used. As a result, a crash will occur.

As an example, if AppStorageFolder have no read/write access, resumption_storage_
fails to initialize.

Co-authored-by: Jacob Keeler <jacob.keeler@livioradio.com>
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.