Fix intermittent shutdown SIGSEGV: reset content downloader handle in UnloadAllExtensions - #909
Open
Buell (JanZachmann) wants to merge 1 commit into
Open
Conversation
ExtensionManager::Uninit() runs twice on shutdown (via AzureDeviceUpdateCoreInterface_Destroy and via ExtensionManager_Uninit). UnloadAllExtensions() dlclose'd the content downloader library but left the static _contentDownloader handle and its V2 contract flag set, so the second call did dlsym(_contentDownloader, "Cleanup") on the freed handle. glibc's do_lookup_x then walked a freed link_map and crashed intermittently with SIGSEGV inside ld.so during agent shutdown (exit-only; agent restarts fine). Reset _contentDownloader and its contract version after the dlclose loop so a repeat unload is a no-op. Root-caused from a symbolized device core. Add a regression test (Uninit twice must not reuse the handle) and fix the existing "Uninit clears ... downloader library state" test, which had asserted the buggy "not cleared" behavior. Pristine 1.4.0 bug (upstream), not introduced by the omnect port. Signed-off-by: Jan Zachmann 50990105+JanZachmann@users.noreply.github.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #908
What
Fix the intermittent shutdown
SIGSEGVinld.so:ExtensionManager::Uninit()runs twice at shutdown, and the second
UnloadAllExtensions()diddlsym(_contentDownloader, "Cleanup")on a content-downloader handle the firstcall had already
dlclosed.do_lookup_xthen walked a freedlink_map.Fix
Reset
_contentDownloaderand its contract version after thedlcloseloop, sothe second unload is a no-op.
Tests
Uninit()calls must not reuse the handle."Uninit clears ... downloader library state"test, whichasserted the buggy "not cleared" behaviour.
Root-caused from a symbolized core; details in the linked issue.