Re: backend dies when C function calls C++ library that throws an exception - Mailing list pgsql-hackers

From Tom Lane
Subject Re: backend dies when C function calls C++ library that throws an exception
Date
Msg-id 14748.1050105300@sss.pgh.pa.us
Whole thread Raw
In response to backend dies when C function calls C++ library that throws an exception  (David Blasby <dblasby@refractions.net>)
List pgsql-hackers
David Blasby <dblasby@refractions.net> writes:
> We are having trouble trapping exceptions thrown by the GEOS C++ 
> library.  The library isworking very well in general, but when GEOS 
> raises an exception that tries to leave the GEOS .so library, postgresql 
> immediately dies (signal 6 - ABORT).

The redhat bugzilla entry you reference suggests that this should work
in Linux, given compatible (and recent) versions of gcc/glibc/glibc++.
Are you up to date on those?

But if you want a general cross-platform solution, you may be out of
luck.  Since there is no C++ library in the standard backend, there
is nothing that would know to set up the C++ exception stack.

(It occurs to me that if it's still failing for you on recent Linux
releases, it might be because your code and GEOS are in separate shared
libs that can't even agree on a common location of the C++ exception
stack pointers.)

The only workaround I can think of is to build a nonstandard postgres
executable that contains libc++ as part of the main executable.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Sean Chittenden
Date:
Subject: Re: [GENERAL] medical image on postgreSQL?
Next
From: Tatsuo Ishii
Date:
Subject: Re: [BUGS] Bug #943: Server-Encoding from EUC_TW to UTF-8 doesn't