Обсуждение: 9.0.3 SIGFAULT on FreeBSD with dtrace

Поиск
Список
Период
Сортировка

9.0.3 SIGFAULT on FreeBSD with dtrace

От
Luca Ferrari
Дата:
HI all,
I'm trying to compile PostgreSQL 9.0.3 on FreeBSD 8.1-stable, and I can make 
it working if I compile without dtrace. However when I compile with --enable-
dtrace I'm unable to use the cluster and even initdb.
In particular initdb claims that:

fgets failure: No such file or directory
The program "postgres" is needed by initdb but was not found in the
same directory as "/usr/local/pgsql/bin/initdb".
Check your installation

but digging a little I found that the problem is when a pipe to postgres -V 
process is created, since the latter goes in SIGFAULT. The following is the 
truss of the postgres command:

__sysctl(0xbfbfe744,0x2,0xbfbfe74c,0xbfbfe750,0x0,0x0) = 0 (0x0)
mmap(0x0,336,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 675897344 (0x28496000)
munmap(0x28496000,336)                           = 0 (0x0)
__sysctl(0xbfbfe7a8,0x2,0x2848ce3c,0xbfbfe7b0,0x0,0x0) = 0 (0x0)
mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 675897344 
(0x28496000)
issetugid(0x28485a47,0xbfbfe870,0x104,0x0,0x0,0x0) = 0 (0x0)
open("/etc/libmap.conf",O_RDONLY,0666)           ERR#2 'No such file or 
directory'
access("/usr/local/pgsql/lib/libm.so.5",0)       ERR#2 'No such file or 
directory'
open("/var/run/ld-elf.so.hints",O_RDONLY,00)     = 2 (0x2)
read(2,"Ehnt\^A\0\0\0\M^@\0\0\0-\0\0\0\0"...,128) = 128 (0x80)
lseek(2,0x80,SEEK_SET)                           = 128 (0x80)
read(2,"/lib:/usr/lib:/usr/lib/compat:/u"...,45) = 45 (0x2d)
close(2)                                         = 0 (0x0)
access("/lib/libm.so.5",0)                       = 0 (0x0)
open("/lib/libm.so.5",O_RDONLY,00)               = 2 (0x2)
fstat(2,{ mode=-r--r--r-- ,inode=1813507,size=146183,blksize=16384 }) = 0 
(0x0)
pread(0x2,0x2848bd80,0x1000,0x0,0x0,0x0)         = 4096 (0x1000)
mmap(0x0,106496,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 675930112 
(0x2849e000)
mmap(0x2849e000,102400,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|
MAP_NOCORE,2,0x0) = 675930112 (0x2849e000)
mmap(0x284b7000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,2,0x18000) = 
676032512 (0x284b7000)
close(2)                                         = 0 (0x0)
access("/usr/local/pgsql/lib/libc.so.7",0)       ERR#2 'No such file or 
directory'
access("/lib/libc.so.7",0)                       = 0 (0x0)
open("/lib/libc.so.7",O_RDONLY,027757763634)     = 2 (0x2)
fstat(2,{ mode=-r--r--r-- ,inode=1813528,size=1346561,blksize=16384 }) = 0 
(0x0)
pread(0x2,0x2848bd80,0x1000,0x0,0x0,0x0)         = 4096 (0x1000)
mmap(0x0,1155072,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 676036608 
(0x284b8000)
mmap(0x284b8000,1036288,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|
MAP_NOCORE,2,0x0) = 676036608 (0x284b8000)
mmap(0x285b5000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,2,0xfd000) = 
677072896 (0x285b5000)
mprotect(0x285bb000,94208,PROT_READ|PROT_WRITE)  = 0 (0x0)
close(2)                                         = 0 (0x0)
sysarch(0xa,0xbfbfe810,0x2845c39b,0x2848b2f8,0x2846ef09,0x2848b2f8) = 0 (0x0)
mmap(0x0,48744,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 677191680 (0x285d2000)
munmap(0x285d2000,48744)                         = 0 (0x0)
mmap(0x0,2072,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 677191680 (0x285d2000)
munmap(0x285d2000,2072)                          = 0 (0x0)
mmap(0x0,21904,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 677191680 (0x285d2000)
munmap(0x285d2000,21904)                         = 0 (0x0)
sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|
SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|
SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
sigprocmask(SIG_SETMASK,0x0,0x0)                 = 0 (0x0)
__sysctl(0xbfbfe7c4,0x2,0x8460670,0xbfbfe7cc,0x0,0x0) = 0 (0x0)
sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|
SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|
SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
sigprocmask(SIG_SETMASK,0x0,0x0)                 = 0 (0x0)
sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|
SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|
SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
sigprocmask(SIG_SETMASK,0x0,0x0)                 = 0 (0x0)
SIGNAL 11 (SIGSEGV)
process exit, rval = 0


and this is the output of ldd:

/usr/local/pgsql/bin/postgres:       libm.so.5 => /lib/libm.so.5 (0x2849e000)       libc.so.7 => /lib/libc.so.7
(0x284b8000)

I checked that dtrace -l gives me output, so it seems to work. Am I doing 
something wrong?

Thanks,
Luca


Re: 9.0.3 SIGFAULT on FreeBSD with dtrace

От
Tom Lane
Дата:
Luca Ferrari <fluca1978@infinito.it> writes:
> I'm trying to compile PostgreSQL 9.0.3 on FreeBSD 8.1-stable, and I can make 
> it working if I compile without dtrace. However when I compile with --enable-
> dtrace I'm unable to use the cluster and even initdb.

You probably need to take that up with some FreeBSD dtrace hackers.

It's possible that we need to adjust PG's dtrace code to support the
FreeBSD implementation, but if so we'd need advice from an expert on
what needs to be changed.
        regards, tom lane


Re: 9.0.3 SIGFAULT on FreeBSD with dtrace

От
Luca Ferrari
Дата:
On Saturday, April 02, 2011 09:12:32 PM Tom Lane's cat walking on the keyboard 
wrote:
> 
> It's possible that we need to adjust PG's dtrace code to support the
> FreeBSD implementation, but if so we'd need advice from an expert on
> what needs to be changed.


Thanks.
In the meantime I attached a debugger and found that postgres crashes 
immediatly as it enters in dtrace_dof_init(), I don't know what it does.
However I'm asking on the freebsd forums for help and involvement.

Luca