Thread: pg_migrator segfault

pg_migrator segfault

From
hernan gonzalez
Date:
I am stuck with a segmentation fault while running pg_upgrade, from 8.4.3 to 9.0.1

$ ./pg_upgrade -d /var/pgsql-8_4_3/data/ -D /var/pgsql-9_0_1/data/ -b /var/pgsql-8_4_3/bin/ -B /var/pgsql-9_0_1/bin/ --check -P 5433 -v -g -G debug
Running in verbose mode
Running in debug mode
PerForming Consistency Checks on Old Live Server
------------------------------------------------
Checking old data directory (/var/pgsql-8_4_3/data)         ok
Checking old bin directory (/var/pgsql-8_4_3/bin)           ok
Checking new data directory (/var/pgsql-9_0_1/data)         ok
Checking new bin directory (/var/pgsql-9_0_1/bin)           ok
Segmentation fault

In my logs :
 pg_upgrade[29259]: segfault at 474e4158 ip b7f444ed sp bfdd35c4 error 4 in libc-2.11.1.so[b7ed1000+16f000]

Both postgres version were compiled from source.  
My environment: Linux Fedora Core 12  (kernel 2.6.30.5-xenU , glibc 2.11.1, gcc 4.4.3)
No custom shared object files. Cluster encoding: LATIN9

Any clues?

Hernán J. González

Re: pg_migrator segfault

From
Grzegorz Jaśkiewicz
Date:
try gdb --args ./pg_upgrade -d /var/pgsql-8_4_3/data/ -D
/var/pgsql-9_0_1/data/ -b /var/pgsql-8_4_3/bin/ -B
/var/pgsql-9_0_1/bin/ --check -P 5433 -v -g -G debug
and when it fails, type in 'bt' and paste it here please.

--
GJ

Re: pg_migrator segfault

From
hernan gonzalez
Date:
2010/11/2 Grzegorz Jaśkiewicz <gryzman@gmail.com>
try gdb --args ./pg_upgrade -d /var/pgsql-8_4_3/data/ -D
/var/pgsql-9_0_1/data/ -b /var/pgsql-8_4_3/bin/ -B
/var/pgsql-9_0_1/bin/ --check -P 5433 -v -g -G debug
and when it fails, type in 'bt' and paste it here please.

--
GJ

Well, this is strange. I run the same command line with gbd, it does not throw the segfault.
The first time it gave me some error, but with sensible info:

===============
Starting program: /var/pgsql-9_0_1/bin/pg_upgrade -d /var/pgsql-8_4_3/data/ -D /var/pgsql-9_0_1/data/ -b /var/pgsql-8_4_3/bin/ -B /var/pgsql-9_0_1/bin/ --check -P 5433 -v -g -G debug
[Thread debugging using libthread_db enabled]
Running in verbose mode
Running in debug mode
Detaching after fork from child process 30334.
Detaching after fork from child process 30335.
PerForming Consistency Checks on Old Live Server
------------------------------------------------
Checking old data directory (/var/pgsql-8_4_3/data)         ok
Checking old bin directory (/var/pgsql-8_4_3/bin)           ok
Checking new data directory (/var/pgsql-9_0_1/data)         ok
Checking new bin directory (/var/pgsql-9_0_1/bin)           ok
Detaching after fork from child process 30336.
Detaching after fork from child process 30337.
Checking for reg* system oid user data types                ok
Checking for /contrib/isn with bigint-passing mismatch      ok
Checking for large objects                                  ok
"/var/pgsql-9_0_1/bin/pg_ctl" -l "/dev/null" -D "/var/pgsql-9_0_1/data" -o "-p 5433 -c autovacuum=off -c autovacuum_freeze_max_age=2000000000" start >> "/dev/null" 2>&1
Detaching after fork from child process 30362.
Trying to start new server                                  .................ok

 Unable to start new postmaster with the command: "/var/pgsql-9_0_1/bin/pg_ctl" -l "/dev/null" -D "/var/pgsql-9_0_1/data" -o "-p 5433 -c autovacuum=off -c autovacuum_freeze_max_age=2000000000" start >> "/dev/null" 2>&1
Perhaps pg_hba.conf was not set to "trust".
Program exited with code 01.
Missing separate debuginfos, use: debuginfo-install glibc-2.11.1-4.i686
========================================================

I found (by calling pg_ctl manually and redirecting the log somewhere) that there was a postmaster.opts not writable by postgres. 
I fixed that, run again, and all seemed well, but...

===============================================================
Reading symbols from /var/pgsql-9_0_1/bin/pg_upgrade...(no debugging symbols found)...done.
(gdb) run
Starting program: /var/pgsql-9_0_1/bin/pg_upgrade -d /var/pgsql-8_4_3/data/ -D /var/pgsql-9_0_1/data/ -b /var/pgsql-8_4_3/bin/ -B /var/pgsql-9_0_1/bin/ --check -P 5433 -v -g -G debug
[Thread debugging using libthread_db enabled]
Running in verbose mode
Running in debug mode
Detaching after fork from child process 30680.
Detaching after fork from child process 30681.
PerForming Consistency Checks on Old Live Server
------------------------------------------------
Checking old data directory (/var/pgsql-8_4_3/data)         ok
Checking old bin directory (/var/pgsql-8_4_3/bin)           ok
Checking new data directory (/var/pgsql-9_0_1/data)         ok
Checking new bin directory (/var/pgsql-9_0_1/bin)           ok
Detaching after fork from child process 30682.
Detaching after fork from child process 30683.
Checking for reg* system oid user data types                ok
Checking for /contrib/isn with bigint-passing mismatch      ok
Checking for large objects                                  ok
"/var/pgsql-9_0_1/bin/pg_ctl" -l "/dev/null" -D "/var/pgsql-9_0_1/data" -o "-p 5433 -c autovacuum=off -c autovacuum_freeze_max_age=2000000000" start >> "/dev/null" 2>&1
Detaching after fork from child process 30708.
Checking for presence of required libraries                 ok

*Clusters are compatible*
"/var/pgsql-9_0_1/bin/pg_ctl" -l "/dev/null" -D "/var/pgsql-9_0_1/data"  stop >> "/dev/null" 2>&1
Detaching after fork from child process 30724.

Program exited normally.
Missing separate debuginfos, use: debuginfo-install glibc-2.11.1-4.i686
==================================================

But when I run the pg_upgrade outside gbd, again the segfault:

===================

./pg_upgrade -d /var/pgsql-8_4_3/data/ -D /var/pgsql-9_0_1/data/ -b /var/pgsql-8_4_3/bin/ -B /var/pgsql-9_0_1/bin/ --check -P 5433 -v -g -G debug
Running in verbose mode
Running in debug mode
PerForming Consistency Checks on Old Live Server
------------------------------------------------
Checking old data directory (/var/pgsql-8_4_3/data)         ok
Checking old bin directory (/var/pgsql-8_4_3/bin)           ok
Checking new data directory (/var/pgsql-9_0_1/data)         ok
Checking new bin directory (/var/pgsql-9_0_1/bin)           ok
Segmentation fault

==============================================

WTF?

Hernán J. González

Re: pg_migrator segfault

From
Tom Lane
Date:
hernan gonzalez <hgonzalez@gmail.com> writes:
> Well, this is strange. I run the same command line with gbd, it does not
> throw the segfault.

Interesting.  Do "ulimit -c unlimited", then run pg_upgrade normally,
and then try "gdb ./pg_upgrade core" (the name of the corefile might
be something different depending on local configuration).

            regards, tom lane