Crash on exit after 'Goodbye!' (static destruction order) → long core dump makes shutdown appear to hang #275
Labels
No labels
amd
avatars
bug
builder
cannot-reproduce
crash
epic
feature
from-viewer
gl-removal
known-limitation
monitoring
parity
perf
platform
priority
critical
priority
high
priority
low
priority
medium
provenance
rendering
rt
status
in-progress
status
testing
status
up-next
triage
ui
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sky_line/Slipstream#275
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom: after closing the viewer the window disappears, but the process lingers for a long time (tens of seconds). A relaunch can't start until it's gone.
Cause (confirmed from logs + symbolized backtrace): it's not a hang. The viewer segfaults in its exit handlers after logging
Goodbye!, and the OS then writes a core dump of a ~12 GB process. The core dump is the long wait.cleanup : Goodbye!/status: stoppedwithin ~4 s ofQUITTING(e.g. 00:08:54 → 00:08:58Z).Segmentation fault (core dumped) bin/do-not-directly-run-slipstream-bin/*** Bad shutdown (139). ***.Backtrace (symbolized against the run's unstripped binary):
Static destruction order:
LLViewerMediaTexture::sMediaMap(newview) is destroyed aftersVKAlphaMutex/sVKAlphaImages(llrender static in llimagegl.cpp), so the media textures' destructors touch an already-destroyed map and mutex.Root regression: the GL strip of LLViewerWindow (
549ab6826c"glr-tools: strip GL from LLViewerWindow and llui scissor") removedLLViewerWindow::shutdownGL()'s texture teardown, includinggTextureList.shutdown(),LLWorldMapView::cleanupTextures(),LLViewerTextureManager::cleanup()(which callsLLViewerMediaTexture::cleanUpClass()→sMediaMap.clear()) andSUBSYSTEM_CLEANUP(LLImageGL). Nothing releases the static texture pointers (default/blank/white/missing images,sMediaMap, …) before static destruction any more.gTextureList.shutdown()now only runs once, after the Vulkan window/device is deleted. The comment says LLViewerMedia cleanup must precede it, and no LLViewerMedia cleanup call is visible inLLAppViewer::cleanupeither; verify.Fix plan:
LLAppViewer::cleanup()beforedelete gViewerWindow(while the VK device still exists), in LL's original order: media plugin/LLViewerMedia cleanup →gTextureList.shutdown()→LLWorldMapView::cleanupTextures()→LLViewerTextureManager::cleanup()→ (any VK-side image teardown the renderer needs).sVKAlphaMutex/sVKAlphaImages, and any similar statics touched from destructors) immune to destruction order: function-local leaky singletons, or an "alive" flag checked in~LLImageGL.LLPointer<LLViewer*Texture>/LLImageGLacross newview for the same pattern.prctl(PR_SET_DUMPABLE)policy / documentingulimit -c) so a crash at exit doesn't stall for a 12 GB dump. Keep dumps available for real crashes though.Verify: quit 10× from busy regions with media present: no
Bad shutdown (139), and the process exits within ~1-2 s ofGoodbye!.Verified done: textures are released before the window goes and the exit statics are order-proof; a live run exits cleanly after 'Goodbye!' with no segfault or core dump. Commits:
4932f2a8c9. Shipped in v1.0.0-beta.4.