Author

Topic: Workaround for random miner crashes in Windows (Read 1140 times)

legendary
Activity: 1726
Merit: 1018
November 10, 2013, 10:42:30 AM
#1
I didn't have my miner app crash on me when I was using GPU mining, it was always the vid driver.  But now that I have some ASICs I see my cgminer randomly crash, often after working just fine for hours.  For my GPU miners I did something similar to what I am going to recommend here except that I had a script which made them shoot me an email and then reboot (since the video driver would almost never allow me to just restart mining without the reboot).  In this case though, ASICs will allow you to just restart the miner.  So to get my miner back up and mining without my intervention I use this method.

I created a batch file that checks if cgminer is running.  If cgminer is running then the script exits, if it is not running it launches it.

Code:
tasklist /FI "IMAGENAME eq cgminer.exe" 2>NUL | find /I /N "cgminer.exe">NUL 
if "%ERRORLEVEL%"=="0" GoTo Eof

start cmd.exe /c "C:\\Launcher.bat"

Launcher.bat is simply the batch file that I use to launch cgminer in the first place.  If you use a different miner and have a similar problem you can just change the executable name in both places of the first line.

I could make a scheduled task to just run this on a regular basis (every 5 minutes or something) but instead I have a scheduled task that runs this only in the event of an application crash event in the event log.  Since the event log only specifies the crashing app in the details, any crashing application will cause this to run which is why it needs to check for cgminer running first in case some other app is what crashed.  Generally though my miners are dedicated and nothing else is happening on the box so an even log event of 1000 in the application log should always be a cgminer crash for me.

Also, depending on how your mining app is crashing and whether or not you have error reporting on you may want to see this: http://stackoverflow.com/questions/4528697/how-to-immediately-terminate-crashed-application
Jump to: