Segmentation fault (core dumped)

Post here if you need help setting up your server, etc.
Post Reply
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Segmentation fault (core dumped)

Post by LOVER$BOY »

Hey guys.

I got this error in one of the server I am hosting. My screenlog.0 picked this up.

Code: Select all

./server.sh: line 29: 21827 Segmentation fault      (core dumped) ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}
This is how I've programmed my server.sh bash file

Code: Select all

#!/bin/bash

tron="/home/vertrex/normal/bin/armagetronad-dedicated"
server="/home/vertrex/others/durf/"

data=${server}
config=${server}"config"
var=${server}"var"
resource=${server}"resource"

ladderlog=${var}"/ladderlog.txt"
rm -rf ${ladderlog}
touch ${ladderlog}

command=${server}"command.txt"
console=${server}"console.txt"

#mkdir ${server}"logs"
screen -S $1 -X log on
screen -S $1 -X logfile ${server}"logs/"$1".log"
screen -S $1 -X logstamp on

while true; do
    #tail -n0 -f -s 0.0001 ${ladderlog} | php ./main.php | ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}
    ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}

    echo "!============================== SERVER RESTARTING IMMEDIATELY ==============================!" >> ${console}
    sleep 1
done
I have absolutely no idea why this happened all of a sudden :/ Would anyone have any idea on why this happened? I don't know much about the Linux side of stuff, so ya... I'm kind of lost about this.
Image
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Segmentation fault (core dumped)

Post by delinquent »

What happened immediately before that?
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Segmentation fault (core dumped)

Post by LOVER$BOY »

delinquent wrote:What happened immediately before that?
Well this is how it looks like in my screenlog.0

Code: Select all

error : Invalid argument
error : Invalid argument
./server.sh: line 29: 21827 Segmentation fault      (core dumped) ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}
So I'm not totally sure what that's supposed to mean. I believe there's something going on in the PHP script I am using but I doubt that should be the problem since I've coded it properly as ever :/
Image
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Segmentation fault (core dumped)

Post by LOVER$BOY »

Oops... double post... :P
Image
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Segmentation fault (core dumped)

Post by delinquent »

Show me line 29 of server.sh?
It might just be a conflict between a new feature and one of your settings.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Segmentation fault (core dumped)

Post by LOVER$BOY »

Really del? I posted the server.sh contents in my previous post (after your first reply). Anyway line 29 is right at the end of file :/ Is it something to do with the end of line character or something?
Image
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Segmentation fault (core dumped)

Post by delinquent »

Brain fart, sorry.

First of all, I'm sorry if none of this makes sense. I've studied bash for all of... about a week.

Is it just me, or is that a newline token that isn't being recognised? Also, it strikes me that something has run out of a specified resource or stack (phrasing?) and the while loop isn't being used properly. I'm somewhat an amateur at best, but I get the impression that splitting up this block:

Code: Select all

while true; do
    #tail -n0 -f -s 0.0001 ${ladderlog} | php ./main.php | ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}
    ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}
Into... say three separate functions might make the script last longer.

Funny, I thought seg faults happened using recursion scripts, not a loop like this?


Also, putting that last part on a new line physically seems to clean up the output.

Also, I'm interested to see if anything changes when you use the full path for ./main.php, it's probably nothing but I have a hunch.
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Segmentation fault (core dumped)

Post by delinquent »

One other thing, chuck me a copy of that php script. I'm gonna tie them in together in an empty shell and see what happens.
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Re: Segmentation fault (core dumped)

Post by dlh »

The armagetronad-dedicated program crashed. You can use GDB to get a backtrace and isolate the problem.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Segmentation fault (core dumped)

Post by LOVER$BOY »

I took out

Code: Select all

#tail -n0 -f -s 0.0001 ${ladderlog} | php ./main.php | ${tron} --vardir ${var} --userdatadir ${data} --resourcedir ${resource} --userconfigdir ${config} --input ${command} >> ${console}
since its not needed in this case since SPAWN_SCRIPT is doing the job nicely.
delinquent wrote:One other thing, chuck me a copy of that php script. I'm gonna tie them in together in an empty shell and see what happens.
Durf doesn't want that script public... :/
dlh wrote:The armagetronad-dedicated program crashed. You can use GDB to get a backtrace and isolate the problem.
Err... idk how to debug with GDB to be honest :? I've been doing some reading on how to use GDB but I would appreciate it if I could get a simple one since this isn't helping me much: https://wiki.archlinux.org/index.php/St ... ging_Guide
Image
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Segmentation fault (core dumped)

Post by Light »

Assuming you can reproduce the crash ..

Code: Select all

gdb ./arma-exec-file
run
Cause the crash ...

Code: Select all

backtrace
quit
Other than the first command, they will be typed when you get the (gdb) prompt.
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1876
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Segmentation fault (core dumped)

Post by kyle »

Light wrote:

Code: Select all

gdb ./arma-exec-file
It may be best to start gdb with --args like this

Code: Select all

gdb --args ./arma-exec-file [all armagetron server arguments]
You may also need to compile with a different CODE_LEVEL to make the backtrace meaningful (with line numbers)
Image
User avatar
/dev/null
Shutout Match Winner
Posts: 819
Joined: Sat Sep 04, 2004 6:28 pm
Location: Chicago-ish

Re: Segmentation fault (core dumped)

Post by /dev/null »

Let this be a lesson to not edit unix type text in notepad.
Post Reply