smartdevicelink / sdl_core

SmartDeviceLink In-Vehicle Software and Sample HMI
BSD 3-Clause "New" or "Revised" License
239 stars 245 forks source link

Core dump on ignition off during registering 20 apps #3928

Closed RomanReznichenkoLuxoft closed 1 year ago

RomanReznichenkoLuxoft commented 2 years ago

Fixes #3857

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

Manual test using steps in issue description

Summary

Problems I fixed.

The first problem. Аn object of this class AppExtension was not given externally without protection. Therefore, I will change the return type from Extensions () to DataAccessor <std :: list >. Where the desired mutex is captured.

Second problem. ApplicationManagerImpl had unprotected deletion of objects used in other threads. Also, I found a duplicate of the is_stopping method. I deleted this one and left the IsStopping method.

Third problem. ResumeCtrlImpl captured the mutex queuelock, which belongs to it, and the mutex from ApplicationManagerImpl, when calling the application(..) method. This created a deadlock, and not a secure use of the application object. So I added getting all the apps and working with this list.

Fourth problem. It consists of two different crash of the program. The first crash when remove mobile_requestlist. The second is when deleting mobile requests from waiting_forresponse. This was due to the use of smart pointers in different threads. They are copied into threads, so we have to delete them in the thread in which we finish working with it. Since these requests are processed in a separate thread, I delete them there if the core stops working during the processing of these requests. Also added a check to see if the core stopped working while adding such requests to the list.

The fifth problem. This is a drop while processing data in one thread and deleting it in another thread. I created a separate mutex to protect this data. Because using the existing one, we do not invest in the time allotted to the timer to perform certain work.

CLA

RomanReznichenkoLuxoft commented 2 years ago

@theresalech This PR is ready for Livio review.

ShobhitAd commented 1 year ago

Closed in favor of https://github.com/smartdevicelink/sdl_core/pull/3939