Reminder: Create & find trunk-related issues here. Legacy Trac tickets are still available. Problems? Workflow feedback? Need a module project? Open a support ticket.

Groovy Module

Ability to stop long-running Groovy scripts

Details

  • Type: New Feature New Feature
  • Status: In Progress In Progress
  • Priority: Must Must
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Keywords:
  • Description:
    Hide

    We currently have no way to interrupt Groovy script evaluation, so a script as simple as this:

    while (1) \{\}

    Can shoot CPU usage to 100% and can only be stopped by restarting Tomcat (stopping the Groovy module doesn't stop the script nor does restarting the OpenMRS web application within Tomcat).

    I would propose that Groovy scripts be run in their own thread and that the Groovy Module administer those threads.

    • As a first pass, we could terminate any Groovy script after 30 seconds. This would be a crude cutoff, but would suffice for 80% or better use cases.
    • A little better would be to increase the auto-termination to 1-5 minutes and provide a cancel/interrupt button on the UI that aborts the script.
    • The ideal solution would be to create a new admin page for the Groovy Module that lists all running Groovy script processes on the server, allowing any of them to be killed.

    Having Groovy scripts evaluated in a separate thread could facilitate streaming output to the client (TRAC-1428) and/or reporting on script progress in the UI (TRAC-1493).

    Show
    We currently have no way to interrupt Groovy script evaluation, so a script as simple as this:
    while (1) \{\}
    Can shoot CPU usage to 100% and can only be stopped by restarting Tomcat (stopping the Groovy module doesn't stop the script nor does restarting the OpenMRS web application within Tomcat). I would propose that Groovy scripts be run in their own thread and that the Groovy Module administer those threads.
    • As a first pass, we could terminate any Groovy script after 30 seconds. This would be a crude cutoff, but would suffice for 80% or better use cases.
    • A little better would be to increase the auto-termination to 1-5 minutes and provide a cancel/interrupt button on the UI that aborts the script.
    • The ideal solution would be to create a new admin page for the Groovy Module that lists all running Groovy script processes on the server, allowing any of them to be killed.
    Having Groovy scripts evaluated in a separate thread could facilitate streaming output to the client (TRAC-1428) and/or reporting on script progress in the UI (TRAC-1493).

Activity

Hide
Robert O'Connor added a comment - 2009-05-16 21:59:48 EDT

Alrighty, I'll try and spend the week prior to soc implementing these changes.

Show
Robert O'Connor added a comment - 2009-05-16 21:59:48 EDT Alrighty, I'll try and spend the week prior to soc implementing these changes.
Hide
Jeremy Keiper added a comment - 2010-03-15 14:22:35 EDT

I'd like to poke this ticket and see if we can get some movement on it. We need to add some form of interaction, whether it's the ability to stop a script mid-run or gathering additional information from the running interface (i.e. here's your options, which one do you want?).

Show
Jeremy Keiper added a comment - 2010-03-15 14:22:35 EDT I'd like to poke this ticket and see if we can get some movement on it. We need to add some form of interaction, whether it's the ability to stop a script mid-run or gathering additional information from the running interface (i.e. here's your options, which one do you want?).
Hide
Robert O'Connor added a comment - 2010-03-16 06:05:01 EDT

I haven't had a chance to do this, if you wanna take over this ticket, be my guest.

I coded a good deal of the backend code that processes the scripts in groovy – primarily for the sheer fact that it's concise and I ripped a lot of the processing code from http://groovyconsole.appspot.com/ – written by none other than Guillaume LaForge, project manager for groovy!

So you may wanna do a quick read of the docs @ http://groovy.codehaus.org – most of it is pretty easy to pick up quickly however

Show
Robert O'Connor added a comment - 2010-03-16 06:05:01 EDT I haven't had a chance to do this, if you wanna take over this ticket, be my guest. I coded a good deal of the backend code that processes the scripts in groovy – primarily for the sheer fact that it's concise and I ripped a lot of the processing code from http://groovyconsole.appspot.com/ – written by none other than Guillaume LaForge, project manager for groovy! So you may wanna do a quick read of the docs @ http://groovy.codehaus.org – most of it is pretty easy to pick up quickly however

People

Dates

  • Created:
    2009-05-16 19:32:51 EDT
    Updated:
    2010-08-04 16:56:54 EDT