Jump to content

Recommended Posts

I'm writing an application where users can plug in their own matlab code via a Mathscript "wrapper".  I need a way of timing out the matlab in case the user creates an infinite loop.

Does anyone know if mathscript provides a native timeout (google didn't find anything when searching "mathscript timeout").

If not, does anyone have any good (hopefully simple) suggestions?

Thanks!

Share this post


Link to post
Share on other sites

I've never used the mathscript node so I can't speak to that but some options that come to mind would be:

-Use VI server to launch the VI that actually runs the mathscript in the background, then kill the VI if it takes to long to return.
-Build the runner VI into an exe and call it, then use windows to kill the exe if it takes to long.
-Allow your user to learn why they shouldn't make infinite loops.

I'm partial to the third but the other two should work if nobody else chimes in with a better way.

Share this post


Link to post
Share on other sites
5 hours ago, smithd said:

I've never used the mathscript node so I can't speak to that but some options that come to mind would be:

-Use VI server to launch the VI that actually runs the mathscript in the background, then kill the VI if it takes to long to return.
-Build the runner VI into an exe and call it, then use windows to kill the exe if it takes to long.
-Allow your user to learn why they shouldn't make infinite loops.

I'm partial to the third but the other two should work if nobody else chimes in with a better way.

Yes +10 :thumbup1:

No. Just because you can doesn't mean you should. :nono:

No. That's Linux thinking and should be derided at every opportunity..:frusty:

:D

Edited by ShaunR
  • Like 1

Share this post


Link to post
Share on other sites
On 8/25/2016 at 11:39 PM, ShaunR said:

No. Just because you can doesn't mean you should. :nono:

No. That's Linux thinking and should be derided at every opportunity..:frusty:

I guess I was thinking if he doesn't trust his user not to make infinite loops they probably shouldn't be trusted with anything else, so an isolated executable would be beneficial...but I guess mathscript can't really do anything?

Also I'm fairly sure anything approaching linux thinking would involve the words "grep", "vim", "fork", "bash", "sudo", and "just follow these 99 very easy steps", and I included none of those words in my proposal :)

Edited by smithd
  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, smithd said:

Also I'm fairly sure anything approaching linux thinking would involve the words "grep", "vim", "fork", "bash", "sudo", and "just follow these 99 very easy steps", and I included none of those words in my proposal :)

That's after you have been told to go away and learn thermodynamics and molecular physics when all you want to do is make a cup of coffee. :D

Share this post


Link to post
Share on other sites

O.K. so it sounds like the preferred answer is to launch it with a VI server and time that out.

On ‎8‎/‎28‎/‎2016 at 6:31 PM, smithd said:

I guess I was thinking if he doesn't trust his user not to make infinite loops they probably shouldn't be trusted with anything else, so an isolated executable would be beneficial...but I guess mathscript can't really do anything?

It is not a matter of trust, I cannot control who the users are.  I'm just trying to provide them an environment where they can develop their matlab scripts with some decent error handling.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.