Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Ticket #1494 (assigned enhancement)

Opened 10 months ago

Last modified 10 months ago

Ability to stop long-running Groovy scripts

Reported by: bmamlin Assigned to: r0bby (accepted)
Priority: critical Milestone:
Component: Groovy Module Keywords:
Cc: r0bby Introductory Ticket: 0
Code Review Status:

Description

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 (#1428) and/or reporting on script progress in the UI (#1493).

Change History

05/16/09 19:33:09 changed by bmamlin

  • cc set to r0bby.

05/16/09 21:57:58 changed by r0bby

  • owner set to r0bby.
  • status changed from new to assigned.

05/16/09 21:59:48 changed by r0bby

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