miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Miniupnpd + CentOS 5 - Segfaults 'error 4' on run

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation
View previous topic :: View next topic  
Author Message
varka



Joined: 27 Oct 2009
Posts: 2

PostPosted: Tue Oct 27, 2009 10:37 pm    Post subject: Miniupnpd + CentOS 5 - Segfaults 'error 4' on run Reply with quote

Hello all,

After following the guide in post titled 'miniupnpd + rhel' by umopdn on compiling miniupnpd, I am recieving the following error in var/log/messages when I attempt to run miniupnpd:

Oct 27 18:15:34 vpn11 miniupnpd[8198]: Unable to open pidfile for writing /var/run/miniupnpd.pid: File exists
Oct 27 18:15:34 vpn11 miniupnpd[8198]: HTTP listening on port 57676
Oct 27 18:15:34 vpn11 kernel: miniupnpd[8198]: segfault at 00000000fbcbe898 rip 0000000000409107 rsp 00000000fbcbe7bc error 4

The pid file error goes away if I remove the pid file left by the previous dying instance manually, so that's not the problem...

Does anyone know what 'error 4' means?

the output of rpm -q iptables gave me iptables-1.3.5-5.3.el5 - the closest match I could find to this on netfilter was iptables-1.3.5. It doesn't complain when compiling so I assume I did this part right!

Can anyone help?

thanks,

Varka
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Oct 29, 2009 1:11 pm    Post subject: Reply with quote

That seems to be a nasty bug Sad
try to compile in debug mode by editing Makefile.linux and enabling CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG
then run the daemon with
Code:
gdb /path/to/miniupnpd
run -d

You should have a better view of where the code is segfaulting Sad
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
varka



Joined: 27 Oct 2009
Posts: 2

PostPosted: Thu Apr 08, 2010 5:32 pm    Post subject: Reply with quote

Heya,

I ran gdb, and came out with the following:

Code:

(gdb) run -d -f /etc/miniupnpd/miniupnpd.conf
Starting program: /usr/sbin/miniupnpd -d -f /etc/miniupnpd/miniupnpd.conf
(no debugging symbols found)
(no debugging symbols found)
Reading configuration from file /etc/miniupnpd/miniupnpd.conf
perm rule added : allow 1024-65535 0a010100/ffffff00 50-65535
perm rule added : deny 0-65535 00000000/00000000 0-65535
miniupnpd[24749]: system uptime is 5856 seconds
miniupnpd[24749]: HTTP listening on port 55268
miniupnpd[24749]: Listening for NAT-PMP traffic on port 5351

Program received signal SIGSEGV, Segmentation fault.
0x000000000040afd7 in ?? ()
(gdb)



Any bright ideas?

It doesn't seem to be compiling it in debug mode for gdb - here's a log of my compilation process:

Code:

-bash-3.2# tar -xvzf miniupnpd-1.4.20100308.tar.gz
-bash-3.2# cd miniupnpd-1.4.20100308
-bash-3.2# nano Makefile.linux
# commented out line
CFLAGS = -Wall -Os -D_GNU_SOURCE
#uncommented line
CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG



-bash-3.2# make -f Makefile.linux config.h
./genconfig.sh
which: no lsb_release in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin)
Configuring compilation for [Linux] [2.6.18-164.6.1.el5xen] with [netfilter] firewall software.
Please edit config.h for more compilation options.
-bash-3.2# make -f Makefile.linux
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o miniupnpd.o miniupnpd.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnphttp.o upnphttp.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnpdescgen.o upnpdescgen.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnpsoap.o upnpsoap.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnpreplyparse.o upnpreplyparse.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o minixml.o minixml.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnpredirect.o upnpredirect.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o getifaddr.o getifaddr.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o daemonize.o daemonize.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnpglobalvars.o upnpglobalvars.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o options.o options.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnppermissions.o upnppermissions.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o minissdp.o minissdp.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o natpmp.o natpmp.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o upnpevents.o upnpevents.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o linux/getifstats.o linux/getifstats.c
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o netfilter/iptcrdr.o netfilter/iptcrdr.c
gcc   miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o upnpreplyparse.o minixml.o upnpredirect.o getifaddr.o daemonize.o upnpglobalvars.o options.o upnppermissions.o minissdp.o natpmp.o upnpevents.o linux/getifstats.o netfilter/iptcrdr.o /usr/lib/libiptc.a   -o miniupnpd
/usr/bin/ld: warning: i386 architecture of input file `/usr/lib/libiptc.a(libip4tc.o)' is incompatible with i386:x86-64 output
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o testupnpdescgen.o testupnpdescgen.c
gcc   testupnpdescgen.o upnpdescgen.o   -o testupnpdescgen
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o testgetifstats.o testgetifstats.c
gcc   testgetifstats.o linux/getifstats.o   -o testgetifstats
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o testupnppermissions.o testupnppermissions.c
gcc   testupnppermissions.o upnppermissions.o   -o testupnppermissions
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o miniupnpdctl.o miniupnpdctl.c
gcc   miniupnpdctl.o   -o miniupnpdctl
gcc -Wall -O -D_GNU_SOURCE -g -DDEBUG   -c -o testgetifaddr.o testgetifaddr.c
gcc   testgetifaddr.o getifaddr.o   -o testgetifaddr
-bash-3.2# make -f Makefile.linux install
sed -i -e "s/^uuid=[-0-9a-f]*/uuid=`(genuuid||uuidgen) 2>/dev/null`/" miniupnpd.conf
strip miniupnpd
install -d /usr/sbin
install miniupnpd /usr/sbin
install -d /etc/miniupnpd
install netfilter/iptables_init.sh /etc/miniupnpd
install netfilter/iptables_removeall.sh /etc/miniupnpd
install --mode=0644 -b miniupnpd.conf /etc/miniupnpd
install -d /etc/init.d
install linux/miniupnpd.init.d.script /etc/init.d/miniupnpd


Any hints to point me in the right direction for compiling this with debug mode on, or any hints as to the cause of the problem?

Thanks,

Varka
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Apr 08, 2010 7:17 pm    Post subject: Reply with quote

use bt in gdb to display the backtrace.
the strip command is removing the debug symbol, so dont "make install"
just make and use the binary generated.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.