[Pdns-users] [recursor] Segmentation fault at startup

2010-05-26 Thread Stephane Bortzmeyer
%  pdns_recursor 
May 26 09:12:12 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
2010, 08:46:38, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting up
May 26 09:12:12 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms of the 
GPL version 2.
May 26 09:12:12 Operating in 32 bits mode
May 26 09:12:12 Reading random entropy from '/dev/urandom'
zsh: segmentation fault  pdns_recursor

Same thing without a /etc/powerdns/recursor.conf. Same thing is run as
root.

% g++ --version
g++ (GCC) 4.1.3 20080704 prerelease (NetBSD nb2 20081120)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% uname -a
NetBSD golgoth 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Oct  1 15:46:16 CEST 2009  
steph...@golgoth:/usr/obj/sys/arch/i386/compile/GENERIC i386

Boost is 1.38.0nb1

With the debugger (I have zero experience in debugging C++ programs):

(gdb) run
Starting program: /usr/sbin/pdns_recursor 
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
May 26 09:13:01 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
2010, 08:46:38, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting up
May 26 09:13:01 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms of the 
GPL version 2.
May 26 09:13:01 Operating in 32 bits mode
May 26 09:13:01 Reading random entropy from '/dev/urandom'

Program received signal SIGSEGV, Segmentation fault.
0x08095a97 in std::string::_S_constructchar const* ()
(gdb) bt
#0  0x08095a97 in std::string::_S_constructchar const* ()
#1  0x0809e390 in std::string::_S_constructchar const* ()
#2  0x080a5215 in std::string::_S_constructchar const* ()
#3  0x0804ccd4 in ?? ()
#4  0x0001 in ?? ()
#5  0xbfbfea78 in ?? ()
#6  0xbfbfea80 in ?? ()
#7  0x0804cc46 in ?? ()
#8  0xbfbfeb88 in ?? ()
#9  0xbfbfea80 in ?? ()
#10 0xbbbf2000 in ?? ()
#11 0xbfb0 in ?? ()
#12 0x in ?? ()

Very little difference when compiling with -O0 -g:

(gdb) run
Starting program: /usr/sbin/pdns_recursor 
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
May 26 09:29:04 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
2010, 09:23:52, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting up
May 26 09:29:04 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms of the 
GPL version 2.
May 26 09:29:04 Operating in 32 bits mode
May 26 09:29:04 Reading random entropy from '/dev/urandom'

Program received signal SIGSEGV, Segmentation fault.
0x080a1fac in std::basic_stringchar, std::char_traitschar, 
std::allocatorchar ::basic_stringchar* ()
(gdb) bt
#0  0x080a1fac in std::basic_stringchar, std::char_traitschar, 
std::allocatorchar ::basic_stringchar* ()
#1  0x080a84b0 in std::basic_stringchar, std::char_traitschar, 
std::allocatorchar ::basic_stringchar* ()
#2  0x080b2e04 in std::basic_stringchar, std::char_traitschar, 
std::allocatorchar ::basic_stringchar* ()
#3  0x0804e044 in ?? ()
#4  0x0001 in ?? ()
#5  0xbfbfea30 in ?? ()
#6  0xbfbfea38 in ?? ()
#7  0x0804dfb6 in ?? ()
#8  0xbfbfeb40 in ?? ()
#9  0xbfbfea38 in ?? ()
#10 0xbbbf2000 in ?? ()
#11 0xbfb0 in ?? ()
#12 0x in ?? ()
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] [recursor] Segmentation fault at startup

2010-05-26 Thread bert hubert
On Wed, May 26, 2010 at 09:29:57AM +0200, Stephane Bortzmeyer wrote:
 %  pdns_recursor 
 % uname -a
 NetBSD golgoth 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Oct  1 15:46:16 CEST 2009 
  steph...@golgoth:/usr/obj/sys/arch/i386/compile/GENERIC i386

Hi Stephane,

Thanks for checking out the PowerDNS Recursor! 

I'm afraid you have discovered that not a lot of testing is done on NetBSD,
although I personally like this BSD the best.

Sadly we do not currently have access to a NetBSD installation to test
against.

 Very little difference when compiling with -O0 -g:
 
 (gdb) run
 Starting program: /usr/sbin/pdns_recursor 
 (no debugging symbols found)

In fact, this is so little difference that I wonder if it really was
compiled with -g, can you double check? OPTFLAGS=-g is probably the best way
to go.

 May 26 09:29:04 Operating in 32 bits mode
 May 26 09:29:04 Reading random entropy from '/dev/urandom'

Can you strace during startup? Or the local equivalent? 

Thanks!

Bert
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] [recursor] Segmentation fault at startup

2010-05-26 Thread Stephane Bortzmeyer
On Wed, May 26, 2010 at 10:08:41AM +0200,
 bert hubert bert.hub...@netherlabs.nl wrote 
 a message of 33 lines which said:

 In fact, this is so little difference that I wonder if it really was
 compiled with -g, can you double check?

It was properly compiled but the Makefile contains a 'strip
$(DESTDIR)/$(SBINDIR)/pdns_recursor' :-( Debugging the non-installed
executable is better:

(gdb) run
Starting program: 
/home/stephane/Programmation/DNS/pdns-recursor-3.2/pdns_recursor 
May 26 10:13:45 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
2010, 09:23:52, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting up
May 26 10:13:45 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms of the 
GPL version 2.
May 26 10:13:45 Operating in 32 bits mode
May 26 10:13:45 Reading random entropy from '/dev/urandom'

Program received signal SIGSEGV, Segmentation fault.
parseACLs () at pdns_recursor.cc:1508
1508  NetmaskGroup* oldAllowFrom = t_allowFrom, *allowFrom=new NetmaskGroup;
(gdb) bt
#0  parseACLs () at pdns_recursor.cc:1508
#1  0x080a84b0 in serviceMain (argc=1, argv=0xbfbfe9dc) at pdns_recursor.cc:1595
#2  0x080b2e04 in main (argc=1, argv=0xbfbfe9dc) at pdns_recursor.cc:1987
(gdb) 

OK, the ACL parsing is not robust enough. What is strange is that,
even without a configuration file (and therefore without ACL), it
crashes at the same place):

(gdb) run
Starting program: 
/home/stephane/Programmation/DNS/pdns-recursor-3.2/pdns_recursor 
May 26 10:14:30 Unable to parse configuration file '/etc/powerdns/recursor.conf'
May 26 10:14:30 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
2010, 09:23:52, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting up
May 26 10:14:30 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms of the 
GPL version 2.
May 26 10:14:30 Operating in 32 bits mode
May 26 10:14:30 Reading random entropy from '/dev/urandom'

Program received signal SIGSEGV, Segmentation fault.
parseACLs () at pdns_recursor.cc:1508
1508  NetmaskGroup* oldAllowFrom = t_allowFrom, *allowFrom=new NetmaskGroup;
(gdb) bt
#0  parseACLs () at pdns_recursor.cc:1508
#1  0x080a84b0 in serviceMain (argc=1, argv=0xbfbfe9dc)
at pdns_recursor.cc:1595
#2  0x080b2e04 in main (argc=1, argv=0xbfbfe9dc) at pdns_recursor.cc:1987
(gdb) 



___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] [recursor] Segmentation fault at startup

2010-05-26 Thread bert hubert
On Wed, May 26, 2010 at 10:18:43AM +0200, Stephane Bortzmeyer wrote:
 It was properly compiled but the Makefile contains a 'strip
 $(DESTDIR)/$(SBINDIR)/pdns_recursor' :-( Debugging the non-installed

For installed binaries, this is common.

 OK, the ACL parsing is not robust enough. What is strange is that,
 even without a configuration file (and therefore without ACL), it
 crashes at the same place):

This probably indicates that your version of NetBSD, compiler  linker have
problems with Thread Local Storage, which is used by variables that start
with 't_' in PowerDNS.

 Program received signal SIGSEGV, Segmentation fault.
 parseACLs () at pdns_recursor.cc:1508
 1508  NetmaskGroup* oldAllowFrom = t_allowFrom, *allowFrom=new 
 NetmaskGroup;

Could you split line 1508 as follows:

NetmaskGroup* oldAllowFrom = t_allowFrom;
NetmaskGroup* allowFrom = new NetmaskGroup;

? If it still crashes on 1508 (and not on 1509), this is definitely a __thread 
problem.

Bert

___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] [recursor] Segmentation fault at startup

2010-05-26 Thread Stephane Bortzmeyer
[BTW, it would be better to do so on a ticketing system but I cannot
find a way to create a new ticket in the PowerDNS Trac.]

On Wed, May 26, 2010 at 10:55:47AM +0200,
 bert hubert bert.hub...@netherlabs.nl wrote 
 a message of 26 lines which said:

 Could you split line 1508 as follows:
 
 NetmaskGroup* oldAllowFrom = t_allowFrom;
 NetmaskGroup* allowFrom = new NetmaskGroup;

(gdb) run
Starting program: 
/home/stephane/Programmation/DNS/pdns-recursor-3.2/pdns_recursor 
May 26 10:59:56 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
2010, 10:58:27, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting up
May 26 10:59:56 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
software, and you are welcome to redistribute it according to the terms of the 
GPL version 2.
May 26 10:59:56 Operating in 32 bits mode
May 26 10:59:56 Reading random entropy from '/dev/urandom'

Program received signal SIGSEGV, Segmentation fault.
parseACLs () at pdns_recursor.cc:1508
1508  NetmaskGroup* oldAllowFrom = t_allowFrom;
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] [recursor] Segmentation fault at startup

2010-05-26 Thread bert hubert
On Wed, May 26, 2010 at 11:01:38AM +0200, Stephane Bortzmeyer wrote:
 [BTW, it would be better to do so on a ticketing system but I cannot
 find a way to create a new ticket in the PowerDNS Trac.]

There is some anti-spam trickery:
TO FILE BUGS, OR CHANGE THE WIKI, CLICK 'LOGIN' ABOVE, USERNAME anon
PASSWORD No Spam without quotes or the space in between '

So the password is NoSpam 

  Could you split line 1508 as follows:
  
  NetmaskGroup* oldAllowFrom = t_allowFrom;
  NetmaskGroup* allowFrom = new NetmaskGroup;
 
 (gdb) run
 Starting program: 
 /home/stephane/Programmation/DNS/pdns-recursor-3.2/pdns_recursor 
 May 26 10:59:56 PowerDNS recursor 3.2 (C) 2001-2010 PowerDNS.COM BV (May 26 
 2010, 10:58:27, gcc 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) starting 
 up
 May 26 10:59:56 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free 
 software, and you are welcome to redistribute it according to the terms of 
 the GPL version 2.
 May 26 10:59:56 Operating in 32 bits mode
 May 26 10:59:56 Reading random entropy from '/dev/urandom'
 
 Program received signal SIGSEGV, Segmentation fault.
 parseACLs () at pdns_recursor.cc:1508
 1508  NetmaskGroup* oldAllowFrom = t_allowFrom;

We could probably boil this issue down to a tiny testcase that would crash
on NetBSD. This could then lead to a bugreport to NetBSD.

Can you try to compile this (g++ t.cc -o t):
#include stdio.h


class Bogo
{
public:

  explicit Bogo(char a)
  {
d_a = a;
  }

  char d_a;
};

__thread Bogo* t_a;

int main()
{
  t_a = new Bogo('a');
  
  Bogo* b = t_a;
  
  printf(%c\n, b-d_a);
}

It is unlikely that PowerDNS will remove the __thread variables since they
work very well on all other relevant platforms ;-(

Bert
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users