Menu

#433 GSL SF errors kill perl and pdl2/perldl shell

normal
closed
nobody
None
5
2017-06-27
2017-04-29
No

Thanks to Shawn Lafan for reporting the problem:

I don't know if it's bit rot, but PDL::GSLSF::GAMMA::gsl_sf_gamma and similar functions blow up the pdl2 and perldl shells when passed a zero or negative value.

This is using the Strawberry Perl PDL distribution, tested with both 5.22.2 and 5.24.1.

Maybe this is long-standing behaviour, but such crash inducing errors should ideally be handled more gracefully.

Thanks,
Shawn.

C:\somedir>pdl2
<...snip...>
Perldl2 Shell v0.008
<...snip...>
Loaded PDL v2.017
pdl> use PDL::GSLSF::GAMMA
pdl> p gsl_sf_gamma (pdl (1..5))
[1 1 2 6 24] [2.220446e-016 2.220446e-016 4.4408921e-016 1.3322676e-015 5.3290705e-015]
pdl> p gsl_sf_gamma (pdl (0..5))
gsl: gamma.c:1264: ERROR: domain error
Default GSL error handler invoked.

Discussion

  • Chris Marshall

    Chris Marshall - 2017-04-29

    The abort is avoided by calling gsl_set_error_handler_off () in the BOOT section of the GSL modules. The current PDL 2.017_01 developers release distribution CHM/PDL-2.017_01.tar.gz has the fix.

    Unfortunately, the default error handling for the GSL::SF::* routines calls barf() which results in a full stack trace duplicating the one from the pdl2 shell and I haven't figured out how to filter it out.

    The good news is that although messy with the stacktrace including all the Devel::REPL and Moose stuff, the error is correctly reported and the perl instance or pdl2 or perldl shell doesn't exit.

     
  • Chris Marshall

    Chris Marshall - 2017-06-27
    • status: pending-fixed --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB