|
From: | Peter Johansson |
Subject: | Re: Segfault at GSL_ERROR |
Date: | Thu, 24 Mar 2022 22:15:03 +1000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 |
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 functionvoid 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
[Prev in Thread] | Current Thread | [Next in Thread] |