{"id":3493,"date":"2017-12-11T06:15:03","date_gmt":"2017-12-11T14:15:03","guid":{"rendered":"https:\/\/www.coretechnologies.com\/blog\/?p=3493"},"modified":"2022-05-01T22:42:58","modified_gmt":"2022-05-02T05:42:58","slug":"auto-generate-crash-dump","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/auto-generate-crash-dump\/","title":{"rendered":"Q &#038; A: How Can I Generate a Crash Dump Before AlwaysUp Restarts my Application?"},"content":{"rendered":"<div align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"\/blog\/images\/qa.webp\" title=\"Q &#038; A\" alt=\"Q &#038; A\" width=\"172\" height=\"127\" border=\"0\" \/><\/div>\n<div class=\"blog-qa-question-box\">\n<img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"https:\/\/cdn.coretechnologies.com\/images\/quotes-transparent-21x21.webp\" width=\"21\" height=\"21\" \/>&nbsp;&nbsp;Occasionally the application we\u2019re running as a service stops responding, resulting in AlwaysUp restarting it. We would like to run a script prior to the restart to try to <b>generate a crash-dump file so we can find out where the problem is<\/b>. Is that possible?<\/p>\n<p align=\"right\">&#8212; Kelly @ <a href=\"https:\/\/www.sabre.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sabre<\/a><\/p>\n<\/div>\n<p>\nHi Kelly. Sorry to hear of the trouble! Please follow these steps to automatically generate a crash dump whenever your application terminates:\n<\/p>\n<ol style=\"margin-left:1.3em;padding:0;\">\n<li>\n<h2><b>Download &amp; install Microsoft&#8217;s free ProcDump utility<\/b><\/h2>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/sysinternals\/downloads\/procdump\" target=\"_blank\" rel=\"noopener noreferrer\">ProcDump<\/a> &#8212; yet another excellent utility from the <a href=\"https:\/\/docs.microsoft.com\/en-us\/sysinternals\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sysinternals<\/a> team &#8212; easily creates a dump file from any running process. It is our tool of choice when exploring application crashes.<\/p>\n<p>Download the ProcDump .Zip package and extract all files to a convenient location. We have placed the files in &#8220;C:\\Apps\\ProcDump&#8221; for this article.<\/p>\n<p>Be sure to run ProcDump at least once and accept the Sysinternals EULA. We don&#8217;t want the utility to hang when we run it unattended as a background service!<\/p>\n<\/li>\n<li>\n<h2><b>Compose the command line to capture a crash dump when your application stops<\/b><\/h2>\n<p>ProcDump features an impressive set of <a href=\"https:\/\/docs.microsoft.com\/en-us\/sysinternals\/downloads\/procdump#using-procdump\" target=\"_blank\" rel=\"noopener noreferrer\">command line options<\/a>. Please review and identify the flags that work best for your situation.<\/p>\n<p>For example, we use this command to dump the notepad.exe application whenever it stops running:<\/p>\n<blockquote><p>c:\\Apps\\ProcDump\\procdump.exe -t notepad<\/p><\/blockquote>\n<p><b>Please ensure that this command works as expected.<\/b> Start your application, run the command and then terminate your application. Is a dump file created? Troubleshot and fix if not.\n<\/p>\n<\/li>\n<li>\n<h2><b>Setup your ProcDump command as a Windows Service in AlwaysUp<\/b><\/h2>\n<p>Your application is running 24&#215;7. To configure ProcDump to operate on the same schedule and capture the dump file at any time:<\/p>\n<ol type=\"a\">\n<li>\n<p>\nStart AlwaysUp and select <b>Application &gt; Add&#8230;<\/b> to bring up the <b>Add Application<\/b> window.\n<\/p>\n<\/li>\n<li>\n<p>\nOn the <b>General tab<\/b>:\n<\/p>\n<p>In the <b>Name<\/b> field, enter a suitable name for this new service. We have used &#8220;ProcDump Notepad&#8221;.<\/p>\n<p>In the <b>Application<\/b> field, enter the full path to ProcDump.exe.<\/p>\n<p>In the <b>Arguments<\/b> field, provide the command line options you developed in step 2. Be sure to add the <b>-w<\/b> flag, which will cause ProcDump to wait for your app to launch if necessary.<\/p>\n<p>And in the <b>Start in directory<\/b> field, enter the folder where you want the dump files to be written. (Leaving this blank will cause dump files to be created in the ProcDump folder.)<\/p>\n<p><a href=\"\/blog\/images\/procdump-notepad-general-tab.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"ProcDump Notepad Service Settings - General\" target=\"_blank\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/procdump-notepad-general-tab.png\" width=\"411\" height=\"592\" title=\"ProcDump Notepad Service Settings - General (click to enlarge)\" alt=\"ProcDump Notepad Service Settings - General\" border=\"0\" ><\/a>\n<\/li>\n<li>\n<p>\nOn the <b>Logon<\/b> tab, specify your windows account. ProcDump should run in this account since you know it works there (and that the EULA has been accepted).\n<\/p>\n<p><a href=\"\/blog\/images\/procdump-notepad-logon-tab.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"ProcDump Notepad Service Settings - Logon\" target=\"_blank\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/procdump-notepad-logon-tab.png\" width=\"411\" height=\"592\" title=\"ProcDump Notepad Service Settings - Logon (click to enlarge)\" alt=\"ProcDump Notepad Service Settings - Logon\" border=\"0\" ><\/a>\n<\/li>\n<li>\n<p>\nClick the <b>Save &gt;&gt;<\/b> button to record the ProcDump service.\n<\/p>\n<\/li>\n<li>\n<p>\nAnd finally, start your new service (from the Application menu).\n<\/p>\n<p>Here is what the finished setup looks like for us, with Notepad running as a service and ProcDump monitoring it (also as a service):<\/p>\n<p><a href=\"\/blog\/images\/procdump-monitoring-notepad.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"ProcDump Notepad Service Settings - Logon\" target=\"_blank\"><br \/>\n<img decoding=\"async\" src=\"\/blog\/images\/procdump-monitoring-notepad.png\" title=\"ProcDump Notepad Service Settings - Logon (click to enlarge)\" alt=\"ProcDump Notepad Service Settings - Logon\" border=\"0\" width=\"500\" ><\/a>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<h2><b>Test<\/b><\/h2>\n<p>Now that everything is in place, you should confirm that a crash dump will be created whenever your application stops.<\/p>\n<p>Open the Task Manager and kill your application. Does a new dump file appear in the expected location? If not, please review all the steps and ensure that nothing was missed.<\/p>\n<\/li>\n<\/ol>\n<p><\/p>\n<p>Best of luck debugging your program!<\/p>\n<!-- relpost-thumb-wrapper --><div class=\"relpost-thumb-wrapper\"><!-- filter-class --><div class=\"relpost-thumb-container\"><style>.relpost-block-single-image, .relpost-post-image { margin-bottom: 10px; }<\/style><h3>You may also like...<\/h3><div style=\"clear: both\"><\/div><div style=\"clear: both\"><\/div><!-- relpost-block-container --><div class=\"relpost-block-container relpost-block-column-layout\" style=\"--relposth-columns: 3;--relposth-columns_t: 2; --relposth-columns_m: 2\"><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/increase-shutdown-time\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: How Do I Give my Windows Service More Time to Stop During Shutdown?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/timeout-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: How Do I Give my Windows Service More Time to Stop During Shutdown?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/detect-endless-loop\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: Why Doesn&#039;t AlwaysUp Catch my Endless Loop?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/no-infinite-loops-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: Why Doesn&#039;t AlwaysUp Catch my Endless Loop?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/version-11-8-released\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"AlwaysUp 11.8: Hourly Restarts, Helpful Application Info, Improved Email Alerts + More\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/software-update-gear-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">AlwaysUp 11.8: Hourly Restarts, Helpful Application Info, Improved Email Alerts + More<\/h2><\/div><\/div><\/a><\/div><!-- close relpost-block-container --><div style=\"clear: both\"><\/div><\/div><!-- close filter class --><\/div><!-- close relpost-thumb-wrapper -->","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;Occasionally the application we\u2019re running as a service stops responding, resulting in AlwaysUp restarting it. We would like to run a script prior to the restart to try to generate a crash-dump file so we can find out where the &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/auto-generate-crash-dump\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3560,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[26,61,66,121,127],"class_list":["post-3493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alwaysup","tag-alwaysup-tag","tag-crash-dump","tag-debugging","tag-procdump","tag-qa"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/3493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=3493"}],"version-history":[{"count":1,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/3493\/revisions"}],"predecessor-version":[{"id":11298,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/3493\/revisions\/11298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/3560"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=3493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=3493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=3493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}