MATLAB Answers

Laurent
0

Dummy error in parfor

Asked by Laurent
on 4 Sep 2013
Latest activity Commented on by Arnon
on 16 Jun 2017
Hi,
While running a parfor loop i am getting the following error:
Caught-error breakpoint was hit in ParallelException>iGetCurrentStack at line 183. The error was:
Error using ParallelException>iGetCurrentStack (line 183)
This is a dummy error
183 error('parallel:internal:cluster:DummyError', 'This is a dummy error')
Does anyone know what this error means?

  1 Comment

Arnon
on 16 Jun 2017
Though it's been four years since the above question was asked, since no one answered, yet, I will give it a try. I recently ran into the same dummy error and looked at the code of iGetCurrentStack. It's some thing like this: try error('dummy error'); catch e return some properties of e; end
Apparently, it first throws the dummy error, then catches it, obtains the stack list of calls from the error object and returns the list - the call stack. Hence the function name.
I personally don't like such code. It's strange to find it in Mathworks own code. I don't think that a try-catch should be part of any normal operation. Try-catch is designated to handle errors, not as an if-then-else GOTO statement. I wonder if there is no better way to access the calls stack?
In any rate, if you too hit it, it only means that you were using, like myself, the debugging event
dbstop if caught error
You may try, at that break point, to Continue. Though, within a parfor, parallel runs don't always behave as expected... Debugging a parfor is still as painful as it was four years ago. All errors are caught and re-thrown at the parfor line, therefore loosing any information about the actual error location. Well, trying to debug if caught error lands right on this mine.

Sign in to comment.

1 Answer

Answer by Elwin Chan on 4 Sep 2013
 Accepted Answer

Hi Laurent,
It looks like you have done
dbstop if all error
or something similar.
That error is used to deduce the current stack and is purely an implementation detail. You don't need to worry about it. I think you'll find more interesting errors further up the stack of your application.
Thanks, Elwin

  0 Comments

Sign in to comment.