Re: backend dies when C function calls C++ library that throws an exception

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Blasby <dblasby(at)refractions(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: backend dies when C function calls C++ library that throws an exception
Date: 2003-04-11 23:55:00
Message-ID: 14748.1050105300@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Blasby <dblasby(at)refractions(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Peacetree 2003-04-12 00:01:40 Re: No merge sort?
Previous Message Sean Chittenden 2003-04-11 23:43:56 Re: [GENERAL] medical image on postgreSQL?