Failure to load h5mma results in hanging during package load

Issue #6 resolved
Ian Hinder created an issue

When launching h5mma from Mathematica, a failure to load the executable (e.g. a segfault or missing dynamic library) manifests itself as a hang in the frontend. This can be interrupted, but an error message would be much better.

If we cannot detect the failure somehow (and this might be a limitation of mathlink) we can use TimeConstrained to time out after 10s or so. Better would be to detect the error message somehow and report it to the user.

Comments (3)

  1. Barry Wardell

    Usually when the binary fails to load, Install[...] returns $Failed and we report an error in such a case. It looks like there are cases where Install never returns. This seems to happen when there is a binary there, but it's not working. I think your TimeConstrained suggestion is probably the best option in this case. How about the following patch:

    diff --git a/h5mma.m b/h5mma.m
    index 9089aad..ece02a2 100644
    --- a/h5mma.m
    +++ b/h5mma.m
    @@ -45,10 +45,10 @@ Module[{installed},
           installed = Install[p1 <> "@" <> host <> "," <> p2 <> "@" <> host, LinkMode -> Connect, LinkProtocol -> "TCPIP"];
         ]
       ,
    -    installed = Install["h5mma"];
    +    installed = TimeConstrained[Install["h5mma"], 10];
       ];
    
    -  If[installed === $Failed,
    +  If[installed === $Failed || installed === $Aborted,
         Print["h5mma has been installed but the MathLink executable cannot be loaded. Check the README file for instructions on compiling it."];
         Abort[];
       ];
    
  2. Ian Hinder reporter

    Looks good, though we might want to change the error message suggesting that they compile it. We could have a list of possible reasons and their fixes, but isn't compiling it quite complicated?

  3. Log in to comment