Issues with C++ exception handling in an FDW - Mailing list pgsql-hackers

From Soules, Craig
Subject Issues with C++ exception handling in an FDW
Date
Msg-id 4D00A61DE9C15F4E9A8644D52DFF9A0537907F39@G4W3296.americas.hpqcorp.net
Whole thread Raw
Responses Re: Issues with C++ exception handling in an FDW  (Robert Haas <robertmhaas@gmail.com>)
Re: Issues with C++ exception handling in an FDW  (Peter Geoghegan <peter@2ndquadrant.com>)
List pgsql-hackers
Hello,

I've run into a very odd issue calling C++ code that uses exceptions from within our PostgreSQL FDW.  Specifically, we
havebroken our FDW into two components, a C layer that looks quite similar to the FDW for text files and a C++ layer
thatis called into by the C layer to interface with our storage file format. 

We compile these two components into separate shared libraries, thus we have:

c-fdw.so
c++-fdw.so

and the c-fdw.so is compiled using -Wl,-rpath to allow it to find the c++-fdw.so at load time.

When there are no errors everything works flawlessly, however, we noticed that even throwing an exception in the C++
layerwas causing an immediate segmentation fault.  Even when encapsulated in a try { } catch(...) { } block. 

If anyone has seen anything like this, any pointers or suggestions would be much appreciated.  I have followed all of
therecommendations in the PostgreSQL documentation, with no luck.  I am not overloading the _init() functions in either
sharedlibrary (another potential source of errors I have read about). 

Thanks!
Craig Soules


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Index-only scan performance regression
Next
From: Andrew Dunstan
Date:
Subject: Re: JSON for PG 9.2