Re: backend process terminates - Mailing list pgsql-general

From Geoffrey
Subject Re: backend process terminates
Date
Msg-id 46B9BC21.40206@serioustechnology.com
Whole thread Raw
In response to Re: backend process terminates  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: backend process terminates  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout wrote:
> On Tue, Aug 07, 2007 at 07:46:45AM -0400, Geoffrey wrote:
>> I don't know all the idiosyncrasies of how this works, so bear with me
>> on this.  The developer at the vendor indicated that he's narrowed down
>> the problem to a set of wrapper routines in their code.  They are named
>> OpenFile(), CloseFile() and ReadFile();  He inquired as to whether there
>> might be routines in the Postgresql code with the same names that might
>> be causing a conflict.  Sure enough, I searched the Postgresql source
>> code and found routines with the same names.  I don't see how this could
>> pose a problem though, as it is my understanding that the compiler will
>> properly address this issue.
>
> Yes, this could cause a problem. In general, when loading a library,
> any external references are first resolved against the main
> executable, then already loaded libraries, then the library being
> loaded. It's all in the ELF standard, if you're interested.

I will be checking them out.  My compiler knowledge is a bit rusty,
circa SVR4... ;)

> As for solutions:
> 1. In your third party library, have the library built in such a way
> that the symbols are explicitly bound to the internal library version.
> There are various methods for dealing with that, it all depends on the
> toolchain used to build it. I suppose this product is actually several
> libraries that call eachother? Namespace would help here.

Correct on both counts.  Many of the routines are wrapper routines used
to assist in code portability.

> 2. Make sure that any externally visible symbols in libraries are
> always prefixed by a tag, like libpq does (almost all symbols are pq*).
>
> Running "nm -D" over the main postgres executable and your libraries
> should give you an idea of the scope of the problem.
>
> Hope this helps,

It appears that the common routine names were causing the problem.  We
are currently testing new versions of these libraries where they have
renamed the common routines with unique names.

Thanks for the insights.

--
Until later, Geoffrey

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Reordering columns, will this ever be simple?
Next
From: "Pavel Stehule"
Date:
Subject: Re: List tables in reverse dependancy order