XBMC Minimal Restart On Crash
#1
Hi Guys,

Have been tearing my hair out over this one the past few days, I have two systems already set up with Olympia's Guide months ago, have now found that people advise against this, but am looking for something similar.

Have tried the latest XBMCLive release, and didn't get on with it, the main problem being that upon crashing XBMC would not restart, I love this functionality and am desperate to get it working.

I read a few threads about Karmic and it using Upstart, so tried instead using Jaunty, I'm having the same problem, when XBMC crashes, I get an x on the screen then it just kicks me out to the command line.

Tried installing the xbmc-live package, and following the XBMCbuntu guide, and still can't for the life of me get it to restart when it crashes.

Using a Zotac ION, and really want to get this sorted, so that my parents can use it, they'll just give up if it doesn't restart when it crashes.

Anyone know where to start with trying to track down the cause ?

Cheers
Reply
#2
Anyone ?
Reply
#3
Just tried the Live Repack version, and get exactly the same behaviour when XBMC crashes it does not try to reboot ?!
Reply
#4
Right, so if XBMC crashes immediately on startup for some reason, you want it to just sit there looping? You'd be better off mapping a button on your remote to start xbmc with irexec.
Reply
#5
No, from my memory, if XBMC crashes during use, the runXBMC script used to re-spawn it, is this not the case any more ?

It did used to sit there looping, this was great, because 9 times out of 10 if something in the skin caused the system to crash, it was pretty easy just to carry on doing stuff, just going back to the command line is not that useful when setting up a machine for my parents.
Reply
#6
This post also seems to reference the same functionality ?! So I'm sure I'm not going crazy :

http://forum.xbmc.org/showthread.php?tid=63712
Reply
#7
Hmmmmm, I think I'm going back to jaunty, managed to find the old files that Olympia references which gave me the desired behaviour !!
Reply
#8
Ok so I've implemented this sanely in the "xbmc-standalone" wrapper script, required minor changes to the "xbmc" wrapper script as well. Both reside in either /usr/bin or /usr/local/bin, can't remember which live uses.

diffs here http://trac.xbmc.org/changeset/26211 mind the filename changes. "xbmc" only requires the changes at lines 72 and 90.
Reply
#9
Thanks will be really useful having this feature back Big Grin
Reply
#10
Thanks for re-adding this feature. Makes the WAF much higher!

I installed the the newest available version from svn (SVN:26540) and it works as advertised. The problem is that now my shutdown abilities have disappeared. Now I only have Hibernate and Suspend under Power saving. Choosing Shutdown from the Shutdown menu only restarts XBMC.

Quote:07:53:45 T:3024631680 M:1874247680 DEBUG: DBus: Creating message to org.freedesktop.DeviceKit.Power on /org/freedesktop/DeviceKit/Power with interface org.freedesktop.DeviceKit.Power and method Hibernate
07:50:40 T:3024631680 M:1893040128 ERROR: DBus: Error org.freedesktop.DeviceKit.Power.GeneralError - not authorized
Reply
#11
I too am having this problem, i never once saw 9.04 crash to console and havent had a keyboard plugged in since I first set it up.

Now with 9.10 it crashes to the console many times, usually when making settings changes. I either have to plug in a keyboard for C+ALT+DEL or power off at the switch....

Ive tried making the changes to the 2 files mentioned above and im getting a strange looping over and over, it loads into the console instead of XBMC for 2sec then loops over an over..


Has anyone got these fixes working ?

Many thanks in advance and fingers crossed !

CODE USED:

Code:
#!/bin/bash
XBMC="pulse-session xbmc --standalone \"$@\""
  pulse-session xbmc --standalone "$@"
else
  XBMC="xbmc --standalone \"$@\""
fi

LOOP=1
CRASHCOUNT=0
LASTSUCCESSFULSTART=$(date +%s)
ulimit -c unlimited
while (( $LOOP ))
do
  $XBMC
  RET=$?
  NOW=$(date +%s)
  if (( ($RET >= 64 && $RET <=66) || $RET == 0 )); then # clean exit
    LOOP=0
  else # crash
    DIFF=$((NOW-LASTSUCCESSFULSTART))
    if (($DIFF > 60 )); then # Not on startup, ignore
      LASTSUCESSFULSTART=$NOW
      CRASHCOUNT=0
    else # at startup, look sharp
      CRASHCOUNT=$((CRASHCOUNT+1))
      if (($CRASHCOUNT >= 3)); then # Too many, bail out
        LOOP=0
        echo "XBMC has exited uncleanly 3 times in the ${DIFF}s. Something is probably wrong"
      fi
    fi
  fi
done


AND

Code:
#!/bin/bash

function single_stacktrace()
{
  find $1 -maxdepth $2 -name 'core*' -exec \
      echo "=====>  Core file: {}" 2> /dev/null >> $FILE \; -exec \
      echo "        ========================================= " 2> /dev/null >> $FILE \; -exec \
      gdb /usr/share/xbmc/xbmc.bin --core={} --batch -ex "thread apply all bt" 2> /dev/null >> $FILE \; -exec \
      rm -f {} \;
}

function print_crash_report()
{
  FILE="xbmc_crashlog-`date +%Y%m%d_%H%M%S`.log"
  echo "############## XBMC CRASH LOG ###############" >> $FILE
  echo >> $FILE
  echo "################ SYSTEM INFO ################" >> $FILE
  echo -n " Date: " >> $FILE
  date >> $FILE
  echo " XBMC Options: $*" >> $FILE
  echo -n " Arch: " >> $FILE
  uname -m >> $FILE
  echo -n " Kernel: " >> $FILE
  uname -rvs >> $FILE
  echo -n " Release: " >> $FILE
  if which lsb_release &> /dev/null; then
    echo >> $FILE
    lsb_release -a 2> /dev/null | sed -e 's/^/    /' >> $FILE
  else
    echo "lsb_release not available" >> $FILE
  fi
  echo "############## END SYSTEM INFO ##############" >> $FILE
  echo >> $FILE
  echo "############### STACK TRACE #################" >> $FILE
  single_stacktrace $PWD 1
  # Find in plugins directories
  if [ $XBMC_HOME ]; then
    BASEDIR=$XBMC_HOME
  else
    BASEDIR=/usr/share/xbmc/
  fi
  single_stacktrace $BASEDIR 5
  # find in user xbmc dir
  single_stacktrace $HOME/.xbmc/ 5
  echo "############# END STACK TRACE ###############" >> $FILE
  echo >> $FILE
  echo "################# LOG FILE ##################" >> $FILE
  echo >> $FILE
  if [[ -f ~/.xbmc/temp/xbmc.log ]]
  then
    cat ~/.xbmc/temp/xbmc.log >> $FILE
    echo >> $FILE
  else
    echo "Logfile not found in the usual place." >> $FILE
    echo "Please attach it seperately." >> $FILE
    echo "Use pastebin.com or similar for forums or IRC." >> $FILE
  fi
  echo >> $FILE
  echo "############### END LOG FILE ################" >> $FILE
  echo >> $FILE
  echo "############ END XBMC CRASH LOG #############" >> $FILE
  echo "Crash report available at $PWD/$FILE"
}

# Set XBMC_HOME if xbmc.bin is a symlink
if [ -L /usr/share/xbmc/xbmc.bin ]; then
  export XBMC_HOME="/usr/share/xbmc"
fi

python /usr/share/xbmc/FEH.py "$@"
if [ $? -ne 0 ]; then
  exit 0
fi
LOOP=1
ulimit -c unlimited
while (( $LOOP ))
do
  LOOP=0
  /usr/share/xbmc/xbmc.bin "$@"
  RET=$?
  if (( $RET == 65 ))
  then # User requested to restart app
    LOOP=1
  elif (( ($RET >= 131 && $RET <= 136) || $RET == 139 ))
  then # Crashed with core dump
    print_crash_report
  fi
done

exit $RET
Reply
#12
i'm not sure if we having the same version of XBMC, because your xbmc startscript is slightly different, but i've got working an automatic restart at a crash only by adding the line written in red.
hope it works for you Smile

burgemaster Wrote:
Code:
#!/bin/bash

function single_stacktrace()
{
  find $1 -maxdepth $2 -name 'core*' -exec \
      echo "=====>  Core file: {}" 2> /dev/null >> $FILE \; -exec \
      echo "        ========================================= " 2> /dev/null >> $FILE \; -exec \
      gdb /usr/share/xbmc/xbmc.bin --core={} --batch -ex "thread apply all bt" 2> /dev/null >> $FILE \; -exec \
      rm -f {} \;
}

function print_crash_report()
{
  FILE="xbmc_crashlog-`date +%Y%m%d_%H%M%S`.log"
  echo "############## XBMC CRASH LOG ###############" >> $FILE
  echo >> $FILE
  echo "################ SYSTEM INFO ################" >> $FILE
  echo -n " Date: " >> $FILE
  date >> $FILE
  echo " XBMC Options: $*" >> $FILE
  echo -n " Arch: " >> $FILE
  uname -m >> $FILE
  echo -n " Kernel: " >> $FILE
  uname -rvs >> $FILE
  echo -n " Release: " >> $FILE
  if which lsb_release &> /dev/null; then
    echo >> $FILE
    lsb_release -a 2> /dev/null | sed -e 's/^/    /' >> $FILE
  else
    echo "lsb_release not available" >> $FILE
  fi
  echo "############## END SYSTEM INFO ##############" >> $FILE
  echo >> $FILE
  echo "############### STACK TRACE #################" >> $FILE
  single_stacktrace $PWD 1
  # Find in plugins directories
  if [ $XBMC_HOME ]; then
    BASEDIR=$XBMC_HOME
  else
    BASEDIR=/usr/share/xbmc/
  fi
  single_stacktrace $BASEDIR 5
  # find in user xbmc dir
  single_stacktrace $HOME/.xbmc/ 5
  echo "############# END STACK TRACE ###############" >> $FILE
  echo >> $FILE
  echo "################# LOG FILE ##################" >> $FILE
  echo >> $FILE
  if [[ -f ~/.xbmc/temp/xbmc.log ]]
  then
    cat ~/.xbmc/temp/xbmc.log >> $FILE
    echo >> $FILE
  else
    echo "Logfile not found in the usual place." >> $FILE
    echo "Please attach it seperately." >> $FILE
    echo "Use pastebin.com or similar for forums or IRC." >> $FILE
  fi
  echo >> $FILE
  echo "############### END LOG FILE ################" >> $FILE
  echo >> $FILE
  echo "############ END XBMC CRASH LOG #############" >> $FILE
  echo "Crash report available at $PWD/$FILE"
[color=red][b]LOOP=1[/b][/color]
}

# Set XBMC_HOME if xbmc.bin is a symlink
if [ -L /usr/share/xbmc/xbmc.bin ]; then
  export XBMC_HOME="/usr/share/xbmc"
fi

python /usr/share/xbmc/FEH.py "$@"
if [ $? -ne 0 ]; then
  exit 0
fi
LOOP=1
ulimit -c unlimited
while (( $LOOP ))
do
  LOOP=0
  /usr/share/xbmc/xbmc.bin "$@"
  RET=$?
  if (( $RET == 65 ))
  then # User requested to restart app
    LOOP=1
  elif (( ($RET >= 131 && $RET <= 136) || $RET == 139 ))
  then # Crashed with core dump
    print_crash_report
  fi
done

exit $RET
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC Minimal Restart On Crash0