Fixed crash when an iAP control session is stopped #1592
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1583
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Unit Tests
No additional test cases were added. Current unit tests passed.
Core Tests
Core version / branch / commit hash / module tested against: SYNC 3 v3.0
HMI name / version / branch / commit hash / module tested against: SYNC 3 v3.0
Summary
All the crash logs attached to the issue show that the crash occurs when the IAP Control Session attempts to close the output stream. I believe the issue is that the output stream's run loop was created on the
lifecycle
thread, which means that thelifecycle
thread owns the stream. The library then closes the output stream from the main thread. Apple's documentation for streams says You should never attempt to access a scheduled stream from a thread different than the one owning the stream’s run loop.The IAP Control Session is only created when connecting to legacy units that don't support the
multisession
protocol. The IAP Data Session opens and closes the streams on theioThread
, which explains why we have not seen this crash on head units that support themultisession
protocol.I changed the code to make sure the iAP control session streams are started on the main thread instead of the
lifecycle
thread so the streams are started and stopped on the same thread.Changelog
Bug Fixes
CLA