#5719 Partial detection of shutdown from task manager#5729
#5719 Partial detection of shutdown from task manager#5729akleshchev merged 3 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a “close request” marker mechanism to better classify viewer terminations (especially Windows Task Manager / external close scenarios) instead of lumping them into generic “unknown” outcomes.
Changes:
- Introduces a new
handlePreCloseRequest()callback to allow fast “about to close” handling (marker creation) before shutdown processing. - Adds a new close marker file (
SecondLife.close_marker) and integrates it into startup marker processing to refine last-execution classification. - Updates Win32 message handling to track SC_CLOSE → WM_CLOSE sequencing and trigger fast-quit behavior for suspected external closes.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| indra/newview/llviewerwindow.h | Adds handlePreCloseRequest() override to viewer window callbacks. |
| indra/newview/llviewerwindow.cpp | Creates close marker on pre-close; schedules marker cleanup for user-driven close flow. |
| indra/newview/llappviewer.h | Adds APIs to create/remove the new close marker. |
| indra/newview/llappviewer.cpp | Adds close marker constant, processes it in processMarkerFiles(), and implements create/remove helpers. |
| indra/llwindow/llwindowwin32.h | Adds Win32 state flag to track whether SC_CLOSE was received. |
| indra/llwindow/llwindowwin32.cpp | Implements SC_CLOSE tracking and new WM_CLOSE behavior; adds extra logging and adjusts WM_DISPLAYCHANGE handling. |
| indra/llwindow/llwindowcallbacks.h | Adds handlePreCloseRequest() to the window callback interface. |
| indra/llwindow/llwindowcallbacks.cpp | Provides default no-op implementation for handlePreCloseRequest(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c417909 to
f437f1e
Compare
f437f1e to
4b61b56
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // mTimer->start() kicks off the thread, any code after | ||
| // start needs to use the mSuspectsAccessMutex | ||
| mTimer->start(); | ||
| } | ||
| mCreateMarkerFnc = set_error_state_callback; | ||
| mCreateMarkerFnc = error_state_callback; | ||
| mClearMarkerFnc = clear_marker_callback; | ||
| mCrashReportFnc = report_callback; | ||
| mNotifyFnc = notify_callback; | ||
| mCrashOnFreeze = crash_on_freeze; |
There was a problem hiding this comment.
LLWatchdog::init() starts the watchdog thread before assigning the callback std::function members. If the timer thread runs before these are set (or sees partially updated state), calling an empty std::function will throw std::bad_function_call and terminate. Assign the callbacks (and mCrashOnFreeze) before starting the timer thread, or initialize them to safe no-op defaults before thread start.
| { | ||
| LLAppViewer* app = LLAppViewer::instance(); | ||
| app->sendLogoutRequest(); | ||
| // Might be better to ask user if user wants to terminate the app or wait. | ||
| OSMessageBox(LLTrans::getString("MBFreezeDetected"), LLTrans::getString("MBFatalError"), OSMB_OK); | ||
| }, |
There was a problem hiding this comment.
This notify callback is invoked from the watchdog timer thread. Calling sendLogoutRequest() (touches gMessageSystem/gAgent) and showing OSMessageBox() from that thread can be unsafe and may deadlock or corrupt state. Consider making this callback only schedule work onto the main thread (e.g., via the mainloop work queue) or call an existing explicitly thread-safe quit path.
We can't be absolutely certain about the source in this case, but at least try to distinguish termination caused by task manager from 'unknowns'.
07ecf11 to
c4b4f16
Compare
Attempt to detect task manager issued shutdowns. We can't be absolutely certain about the source in this case, but at least try to distinguish termination caused by task manager from 'unknown' crashes.
This change depends onto previous watchdog improvements, so I had to cherry pick it from 26.2 early.