====== Vibemosphere Shutdown Watchdog ====== Watches how long the shutdown takes and reports the threads that keep Vibecat from stopping (after 10 s by default). ^ Id | ''shutdown-watchdog'' | ^ Role | ''deployment'' - needed for the page and the REST API (administrators always may) | ^ Page | **Plugins > Open** (overlay with an X at the top right) or ''/plugins/shutdown-watchdog/'' | ^ REST | ''/api/plugins/shutdown-watchdog/...'' and, for callers with the role, ''/plugins/shutdown-watchdog/...'' | ===== Open the configuration ===== In the administration open **Plugins**, select the row of this plug-in and press **Open**. The page opens in an overlay dialog: close it with the **X** at the top right, with Esc or by clicking outside; //Open in a new tab// next to the title shows it full size. {{vibecat:plugin-shutdown-watchdog.png?900|Vibemosphere Shutdown Watchdog: the plug-in page in its overlay dialog}} ===== Step by step ===== - Set the number of seconds after which Vibecat reports the threads that keep it from stopping (default 10). The report appears on the **Shutdown** page and in the log. ===== The page in detail ===== {{vibecat:plugin-shutdown-watchdog-full.png?900|Vibemosphere Shutdown Watchdog: the whole page (playground instance)}} The page has these sections: **Settings**, **Last report of a slow shutdown**, **Threads now**. ===== Fields and columns ===== ^ Label ^ Meaning ^ | Warn after (seconds) | | | Repeat the report every (seconds) | | | Reports at most | | | End the JVM after (seconds, 0 = never) | | ===== Actions ===== * **Save** * **Show the threads now** ===== Notes from the page ===== * Ending the JVM (Runtime.halt) skips whatever the shutdown still had to do (open files, sessions): use it only so that a stuck service does not hang forever. ===== Reference ===== Vibecat tells the plug-ins first when a shutdown begins (''shutdownStarted'': service stop, SIGTERM, Ctrl+C, console key **q**, **Stop** in the Windows service). The watchdog then starts a daemon thread (it never keeps the JVM alive) that times the shutdown. After the threshold (default **10 s**) it writes a **WARN** report to the console / service log, the log page of Vibecat and ''reports.log'' in the data folder of the plug-in (the last report is shown on the page), and repeats it every 10 s (at most 6 times). ==== What the report says ==== ^ Section ^ Meaning ^ | Deadlock | Threads that wait for each other (JVM deadlock detection), with the locks | | Threads in the shutdown path | Threads whose stack is in the stop of Vibecat, Tomcat, a web application (''contextDestroyed'', ''destroy''), a plug-in or an executor that awaits termination, with the lock they wait for and their stack | | Blocked threads | Threads waiting for a monitor, the thread that holds it, what that one does | | Non-daemon threads | Threads that keep the JVM running when the stop method returns without ''System.exit'' (the Windows service in jvm mode) | | Web applications that still have threads | Threads grouped by the web application of their class loader: the application that did not stop its pools, timers or threads | | Threads that wait while they hold a lock | The usual cause of a stuck stop | ==== Settings and REST ==== ''enabled'', ''thresholdSeconds'', ''repeatSeconds'', ''maxReports'' and ''haltSeconds'' (0 = never; otherwise the JVM is ended with ''Runtime.halt'' after that time so that a stuck service does not hang forever - the report is written first). ''GET|PUT /plugins/shutdown-watchdog/settings'', ''GET /plugins/shutdown-watchdog/status'' (last report), ''GET /plugins/shutdown-watchdog/dump'' (the same analysis of the running Vibecat, to see what it shows). [[vibecat:plugins:start|All plug-ins]]