Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wolfram Engineering: Better error handling, reporting #34

Open
holyjak opened this issue Feb 2, 2024 · 0 comments
Open

Wolfram Engineering: Better error handling, reporting #34

holyjak opened this issue Feb 2, 2024 · 0 comments
Labels
Wolfram Eng Need help/advice from Wolfram Engineering

Comments

@holyjak
Copy link
Member

holyjak commented Feb 2, 2024

A major problem with Wolfram we experience is the lack of insight when things go wrong - either when trying to start the kernel, when communicating with it, or during the evaluation of an expression. The question is, how can we detect something went wrong, and how can we get details of what went wrong / what to do?

Regarding evaluation, often when there is a problem, we just get back an unavealuated expression, with no indication of the problem. The same expression typed in Wolfram does the same, but also prints some explanation.

Examples

Kernel errors

Sometimes, we fail to start a kernel, and get back rather useless exception:

com.wolfram.jlink.MathLinkException: MathLink connection was lost.

Stack trace:
 [[com.wolfram.jlink.NativeLink nextPacket NativeLink.java 305]
  [com.wolfram.jlink.WrappedKernelLink nextPacket WrappedKernelLink.java 237]
  [com.wolfram.jlink.KernelLinkImpl waitForAnswer KernelLinkImpl.java 174]
  [com.wolfram.jlink.KernelLinkImpl discardAnswer KernelLinkImpl.java 191]

This error may have any number of causes and I do not know how to find out more. One possible cause is that we are trying to start n+1st kernel, while our license only allows for n.

The way we start the kernel is:

try {
  MathLinkFactory.createKernelLink({"-linkmode", "launch", "-linkname",
     "\"//Applications/Wolfram Engine.app/Contents/Resources/Wolfram Player.app/Contents/MacOS/MathKernel\" -mathlink"})
    .discardAnswer();
} catch (Exception e) { ...}

Evaluation errors

Example (W. Alpha call when being online):

(wl/eval "WolframAlpha[\"How many licks does it take to get to the center of a Tootsie Pop?\"]")
; => []

When we do the same thing in Wolfram Script:

In[1]:= WolframAlpha["How many licks does it take to get to the center of a Toot
sie Pop?"]                                                                      

URLFetch::invhttp: 
   A library error occurred. The raw details are: "libcurl error (6): 
    Could not resolve host: api.wolframalpha.com"

Out[1]= {}

The way we evaluate expressions is effectively this:

KernelLink link = ''';
/*...jlink.*/Expr expr = ''';
link.evaluate(expr).waitForAnswer();
return link.getExpr();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Wolfram Eng Need help/advice from Wolfram Engineering
Projects
None yet
Development

No branches or pull requests

1 participant