Skip site navigation (1) Skip section navigation (2)

Issues with C++ exception handling in an FDW

From: "Soules, Craig" <craig(dot)soules(at)hp(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Issues with C++ exception handling in an FDW
Date: 2012-01-30 23:04:02
Message-ID: 4D00A61DE9C15F4E9A8644D52DFF9A0537907F39@G4W3296.americas.hpqcorp.net (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello,

I've run into a very odd issue calling C++ code that uses exceptions from within our PostgreSQL FDW.  Specifically, we have broken our FDW into two components, a C layer that looks quite similar to the FDW for text files and a C++ layer that is 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++ layer was 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 the recommendations in the PostgreSQL documentation, with no luck.  I am not overloading the _init() functions in either shared library (another potential source of errors I have read about).

Thanks!
Craig Soules

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2012-01-30 23:35:53
Subject: Re: Group commit, revised
Previous:From: Adrian KlaverDate: 2012-01-30 22:20:24
Subject: Re: pg_dump -s dumps data?!

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group