Обсуждение: PSQL segmentation fault after setting host

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

PSQL segmentation fault after setting host

От
Morgan Taschuk
Дата:
Hi,

I hope someone can help me. When running psql from the command line with
the PGHOST environment variable or the -h command line host set, it
throws a segmentation fault.

$ psql -U morgan -d cid -h localhost
Segmentation fault
$ export PGHOST=rhyme.ncl.ac.uk
$ psql -U morgan -d cid
Segmentation fault


I can run psql from another machine with -h accessing the same database.
I can also run psql without a host.

$ export PGHOST=
$ psql -U morgan -d cid
psql (8.4.3)
Type "help" for help.

cid=# \q


I'm running Ubuntu 9.10 with Postgresql 8.4 I have uninstalled, purged,
and then reinstalled postgresql-8.4, postgresql-client-common
postgresql-common from Ubuntu repositories. I'm not sure what else to
do. Is there something silly that I'm missing?

Please, if there are any logs or anywhere else I can look for more
information on what is actually happening, I would be very grateful.

Thank you.

Sincerely,
Morgan Taschuk

Re: PSQL segmentation fault after setting host

От
Tom Lane
Дата:
Morgan Taschuk <m.taschuk@newcastle.ac.uk> writes:
> I hope someone can help me. When running psql from the command line with
> the PGHOST environment variable or the -h command line host set, it
> throws a segmentation fault.

> $ psql -U morgan -d cid -h localhost
> Segmentation fault

Huh.  Can you get a stack trace from that?  Try like this:

    $ gdb /path/to/psql
    ...
    gdb> run -U morgan -d cid -h localhost
    ... should stop with a report of a segfault ...
    gdb> bt
    ... we need to see what's printed here ...
    gdb> quit

If the bt output is all numbers it won't be helpful.  On Red Hat
systems the thing to do is install the postgresql-debuginfo RPM
that matches your postgresql RPMs, but I'm not sure exactly how
Ubuntu packages that information.

Also it would be good to show the output of ldd applied to psql.

            regards, tom lane

Re: PSQL segmentation fault after setting host

От
Morgan Taschuk
Дата:
Hi, stack traces and other paraphernalia below:

>> $ psql -U morgan -d cid -h localhost
>> Segmentation fault
>
> Huh.  Can you get a stack trace from that?

$ gdb psql
...
Reading symbols from /usr/lib/postgresql/8.4/bin/psql...(no debugging
symbols found)...done.
(gdb) run -U morgan -d cid -h localhost
Starting program: /usr/lib/postgresql/8.4/bin/psql -U morgan -d cid -h
localhost
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0xb7bbb4eb in X509_VERIFY_PARAM_inherit () from
/lib/i686/cmov/libcrypto.so.0.9.8
(gdb) bt
#0  0xb7bbb4eb in X509_VERIFY_PARAM_inherit () from
/lib/i686/cmov/libcrypto.so.0.9.8
#1  0xb7f9b61a in ssl_verify_cert_chain () from
/lib/i686/cmov/libssl.so.0.9.8
#2  0xb7f82582 in ssl3_get_server_certificate () from
/lib/i686/cmov/libssl.so.0.9.8
#3  0xb7f83bfd in ssl3_connect () from /lib/i686/cmov/libssl.so.0.9.8
#4  0xb7f9739a in SSL_connect () from /lib/i686/cmov/libssl.so.0.9.8
#5  0xb7fc392d in pqsecure_open_client () from
/opt/PostgreSQL/psqlODBC/lib/libpq.so.5
#6  0xb7fb58a9 in PQconnectPoll () from
/opt/PostgreSQL/psqlODBC/lib/libpq.so.5
#7  0xb7fb619e in connectDBComplete () from
/opt/PostgreSQL/psqlODBC/lib/libpq.so.5
#8  0xb7fb7b2d in PQsetdbLogin () from
/opt/PostgreSQL/psqlODBC/lib/libpq.so.5
#9  0x00125808 in main () from /usr/lib/postgresql/8.4/bin/psql


> If the bt output is all numbers it won't be helpful.  On Red Hat
> systems the thing to do is install the postgresql-debuginfo RPM
> that matches your postgresql RPMs, but I'm not sure exactly how
> Ubuntu packages that information.

It's not all numbers and I can't seem to find an equivalent to that
package, so is it okay without?

> Also it would be good to show the output of ldd applied to psql.

$ ldd psql
    linux-gate.so.1 =>  (0x0084c000)
    libpq.so.5 => /opt/PostgreSQL/psqlODBC/lib/libpq.so.5 (0x00666000)
    libssl.so.0.9.8 => /lib/i686/cmov/libssl.so.0.9.8 (0x00256000)
    libreadline.so.5 => /lib/libreadline.so.5 (0x00cdd000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00110000)
    libssl.so.4 => /opt/PostgreSQL/psqlODBC/lib/libssl.so.4 (0x009d9000)
    libcrypto.so.4 => /opt/PostgreSQL/psqlODBC/lib/libcrypto.so.4 (0x00531000)
    libkrb5.so.3 => /opt/PostgreSQL/psqlODBC/lib/libkrb5.so.3 (0x00a2c000)
    libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0x00bec000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x0072d000)
    libcrypto.so.0.9.8 => /lib/i686/cmov/libcrypto.so.0.9.8 (0x0029c000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x003e2000)
    libz.so.1 => /lib/libz.so.1 (0x003e6000)
    libncurses.so.5 => /lib/libncurses.so.5 (0x003fc000)
    /lib/ld-linux.so.2 (0x00924000)
    libgssapi_krb5.so.2 => /opt/PostgreSQL/psqlODBC/lib/libgssapi_krb5.so.2
(0x00eee000)
    libcom_err.so.2 => /lib/libcom_err.so.2 (0x00434000)
    libk5crypto.so.3 => /opt/PostgreSQL/psqlODBC/lib/libk5crypto.so.3
(0x00806000)
    libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0x00438000)

>             regards, tom lane

Is that helpful at all?


Thanks again,

Morgan Taschuk

Re: PSQL segmentation fault after setting host

От
Richard Huxton
Дата:
On 22/04/10 20:06, Morgan Taschuk wrote:
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7bbb4eb in X509_VERIFY_PARAM_inherit () from
> /lib/i686/cmov/libcrypto.so.0.9.8
> (gdb) bt
> #0 0xb7bbb4eb in X509_VERIFY_PARAM_inherit () from
> /lib/i686/cmov/libcrypto.so.0.9.8
> #1 0xb7f9b61a in ssl_verify_cert_chain () from
> /lib/i686/cmov/libssl.so.0.9.8

See if disabling ssl fixes it (see your pg_hba.conf and look for
"hostssl" lines).

> /opt/PostgreSQL/psqlODBC/lib/libpq.so.5

I'd guess the root cause is here though. You seem to be picking up some
libraries from psqlODBC rather than your main package. I'm betting it's
got some incompatible changes. Uninstall psqlodbc for a minute and see
if that solves your problem.

> libssl.so.4 => /opt/PostgreSQL/psqlODBC/lib/libssl.so.4 (0x009d9000)
> libcrypto.so.4 => /opt/PostgreSQL/psqlODBC/lib/libcrypto.so.4 (0x00531000)
> libkrb5.so.3 => /opt/PostgreSQL/psqlODBC/lib/libkrb5.so.3 (0x00a2c000)
> libgssapi_krb5.so.2 => /opt/PostgreSQL/psqlODBC/lib/libgssapi_krb5.so.2
> libk5crypto.so.3 => /opt/PostgreSQL/psqlODBC/lib/libk5crypto.so.3


--
   Richard Huxton
   Archonet Ltd

Re: PSQL segmentation fault after setting host

От
Tom Lane
Дата:
Richard Huxton <dev@archonet.com> writes:
> I'd guess the root cause is here though. You seem to be picking up some
> libraries from psqlODBC rather than your main package. I'm betting it's
> got some incompatible changes. Uninstall psqlodbc for a minute and see
> if that solves your problem.

Yeah, the fact that it's linking to two different copies of the same
libraries is pretty scary.  I'm not sure what the /opt/PostgreSQL
stuff is but it's surely not the standard install for your platform.

            regards, tom lane

Re: PSQL segmentation fault after setting host

От
Craig Ringer
Дата:
On 23/04/2010 2:06 AM, Tom Lane wrote:

> On Red Hat
> systems the thing to do is install the postgresql-debuginfo RPM
> that matches your postgresql RPMs, but I'm not sure exactly how
> Ubuntu packages that information.

Though it turns out to be unnecessary for this person's question, for
future reference:


http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD#Installing_External_symbols

--
Craig Ringer

Re: PSQL segmentation fault after setting host

От
Morgan Taschuk
Дата:
Hooray, uninstalling psqlODBC worked! Thank you so much for all of your
help!

Cheers,
Morgan Taschuk

Craig Ringer wrote:
> On 23/04/2010 2:06 AM, Tom Lane wrote:
>
>> On Red Hat
>> systems the thing to do is install the postgresql-debuginfo RPM
>> that matches your postgresql RPMs, but I'm not sure exactly how
>> Ubuntu packages that information.
>
> Though it turns out to be unnecessary for this person's question, for
> future reference:
>
>
http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD#Installing_External_symbols
>
> --
> Craig Ringer