From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brent Verner <brent@rcfile.org>
Cc: Murray Prior Hobbs <murray@efone.com>
Cc: Lamar Owen <lamar.owen@wgcr.org>
Cc: pgsql-hackers@postgresql.org
Subject: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: Sun, 20 Jan 2002 13:40:17 -0500
Message-ID: <4640.1011552017@sss.pgh.pa.us> (raw)
In-Reply-To: <20020120065929.A9940@rcfile.org>
References: <web-622700@davinci.ethosmedia.com>
<3C482537.9040005@efone.com>
<6420.1011366281@sss.pgh.pa.us>
<3C48F172.60302@efone.com>
<11962.1011413533@sss.pgh.pa.us>
<3C49273E.8080307@efone.com>
<20020119031917.A83905@rcfile.org>
<3C493100.2070905@efone.com>
<20020120065929.A9940@rcfile.org>
Brent Verner <brent@rcfile.org> writes:
> Can someone verify that pltcl works on
> their stock redhat 7.2 system?
Indeed it does not. On a straight-from-the-CD RH 7.2 install and
CVS-tip Postgres, I see both of the behaviors Murray complained of.
What I think is particularly nasty is that we get an exit(127) when
the symbol resolution fails, leading to database restart. This will
probably happen on *most* systems not only Linux, because we are
specifying RTLD_LAZY in our dlopen() calls, meaning that missing
symbols should be flagged when they are referenced at runtime --- and
if we call a function that should be there and isn't, there's not much
the dynamic loader can do except throw a signal or exit().
What we should be doing is specifying RTLD_NOW to dlopen(), so that
any unresolved symbol failure occurs during dlopen(), when we are
prepared to deal with it in a clean fashion.
I ran into this same behavior years ago on HPUX and fixed it by using
what they call BIND_IMMEDIATE mode; but I now see that most of the
other ports are specifying RTLD_LAZY, and thus have this problem.
Unless I hear a credible counter-argument, I am going to change
RTLD_LAZY to RTLD_NOW in src/backend/port/dynloader/linux.h. I have
tested that and it produces a clean error with no backend crash.
What I would *like* to do is make the same change in all the
port/dynloader files that reference RTLD_LAZY:
src/backend/port/dynloader/aix.h
src/backend/port/dynloader/bsdi.h
src/backend/port/dynloader/dgux.h
src/backend/port/dynloader/freebsd.h
src/backend/port/dynloader/irix5.h
src/backend/port/dynloader/linux.h
src/backend/port/dynloader/netbsd.h
src/backend/port/dynloader/openbsd.h
src/backend/port/dynloader/osf.h
src/backend/port/dynloader/sco.h
src/backend/port/dynloader/solaris.h
src/backend/port/dynloader/svr4.h
src/backend/port/dynloader/univel.h
src/backend/port/dynloader/unixware.h
src/backend/port/dynloader/win.h
However I'm a bit scared to do that at this late stage of the release
cycle, because perhaps some of these platforms don't support the full
dlopen() API. Comments? Can anyone test whether RTLD_NOW works on
any of the above-mentioned ports?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, brent@rcfile.org, murray@efone.com, lamar.owen@wgcr.org, pgsql-hackers@postgresql.org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
In-Reply-To: <4640.1011552017@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox