BitShares Forum

Other => Graveyard => BitShares PTS => Topic started by: yago on November 11, 2013, 12:59:51 pm

Title: PTSMINER-WATCHDOG (updated) | "force reconnect if possible!" errors
Post by: yago on November 11, 2013, 12:59:51 pm
Not sure why, but got those "force reconnect if possible!" errors.

Found a post by xolokram @ peercointalk that says:

Quote
"the typical behaviour for the miner when the connection is lost is to continue mining for 5 minutes (this is when the "force reconnect if possible!" log line appears) and when a thread finds a share during this period, the thread waits until the connection is back again to submit it. unfortunately the triggers are not always working correctly (the current implementation is a bit 'clunky' regarding connection loss) and a thread continues mining forever on the old block. especially when you have unstable connections or partly blocked connections or any behaviour that's far off from (let's say) "normal".
http://www.peercointalk.org/index.php?topic=501.240

I've just made a simple software watchdog that restarts ptsminer if detects a "force reconnect" error. Just change the folder, pooluser and genproclimit to mine @ beer pool.

Edit: Added proper process killing with Ctrl-C and move old log to ~/ptsminer.log.old

Code: [Select]
#!/bin/bash

#Tips welcome :) PYfnvSc9CRHCebGDtVkSijo6k7pCbpPthX

function launchptsminer {
echo "######## Starting ptsminer... ########"
cd ~/src/ptsminer/src/
./ptsminer -poolip=ptsmine.beeeeer.org -poolport=1337 -poolpassword=0 -pooluser=PYfnvSc9CRHCebGDtVkSijo6k7pCbpPthX -genproclimit=4 > ~/ptsminer.log &
}

control_c()
{
echo "######## Stopping  ########"
ps aux | grep tail | grep ptsminer | awk  '{print "kill "$2}' | sh
killall ptsminer
exit 0
}
 
trap control_c SIGINT

mv ~/ptsminer.log ~/ptsminer.log.old 2> /dev/null

launchptsminer

tail -f ~/ptsminer.log &

while true
do
grep "force reconnect" ~/ptsminer.log
if [ $? -eq 0 ]
then
echo "######## Force reconnect DETECTED ########"
echo "######## Killing ptsminer... ########"
killall ptsminer
echo "######## Wait 5 secs... ########"
sleep 5s
launchptsminer
fi
sleep 1s
done
Title: Re: PTSMINER-WATCHDOG | "force reconnect if possible!" errors
Post by: xolokram on November 11, 2013, 02:55:38 pm
yup, someone (and in the end this means: xolokram ) has to re-code the connection management. it got bloated for historical reasons. :(

anyway, nice script.

- xolokram