Hi Miroslav,

On 24/3/22 00:05, Miroslav Dikov via Bug reports for the GNU Scientific Library wrote:
Dear developers,
(@Moderator: I am reposting a public issue from my personal email - the 
information contained therein is not confidential.)

I have recently run into an issue where a Python wrapped version of a library 
that uses GSL in the C++ layer (Sire) crashes out with a segmentation fault 
when a GSL_ERROR is raised, even though it is in a try/except block 
(https://github.com/michellab/Sire/blob/8049f0e5daf84df1848574758876c25e11bd4b4d/corelib/src/libs/SireMaths/matrix.cpp#L659-L665).
 I assume this is not intended behaviour, as it makes the Python application 
crash without any option for recovery.
You can also see more information about the issue 
here:https://github.com/michellab/BioSimSpace/issues/287.

Lester describes the most straightforward solution in that thread (after you sent your email), i.e., calling

gsl_set_error_handler_off();

Alternatively, you can call gsl_set_error_handler(&my_error_func);

and implement and function
void my_error_func(const char* reason, const char* file, int line, int gsl_errno)

When I work against GSL in C++, I usually have a my_error_func that throws an exception, so errors are not missed but also can be caught and handled.

Cheers,
Peter
  • Segfault at ... Miroslav Dikov via Bug reports for the GNU Scientific Library
    • Re: Seg... Peter Johansson

Reply via email to