Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Background task error


I get the following error on testrail when running the background tasks. Test emails go out but some emails stay on queue. This is the error I get:

[ERROR] 2011-10-18 12:52:54 [211ms]: [ModelException] Another task instance is still running.
at ex::raise (ex.php:23)
at ex::raise (model.php:67)
at Model->_raiset (task.php:55)
at Task_model->_trx_acquire_lock (callback.php:58)
at callback::runv (database.php:1002)
at Database_library->_transaction_run (database.php:1093)
at Database_library->transaction_run (task.php:27)
at Task_model->acquire_lock (tasks.php:81)
at Tasks_controller->_acquire_lock (tasks.php:110)
at Tasks_controller->index (controller.php:76)
at Controller->_invoke_cli (controller.php:64)
at Controller->_invoke (gizmo.php:108)
at require_once (index.php:106)
at require_once (task.php:44)


Hello Jorge,

Thanks for your posting. This message is added to the log when the interval between two task runs is too short and the task is still running when executed again.

As an example, if you schedule the task to run every minute and it takes more than one minute to execute it (e.g. when there are many emails to send), the second time it is executed it sees that a previous task instance is still running and then exits accordingly (and writes the mentioned message to the log). This is the expected behavior and not an error. This still gets added to the system log just for logging purposes.

You can increase the interval of the task to e.g. 5 minutes to reduce the number of such entries (by changing the cron entry or the Windows scheduler task).

Regarding the emails: do you usually receive emails when another person assigns you a test?

I hope this helps,


Hello Tobias,

I used to recieve emails when a test was assigned but not anymore, not since the last testrail upgrade. Now they all remain in the messages table. I reset the server, set the task to run every 5 minutes, stopped the task and I still get the error. As a last resort I reset the IIS and the server but I still get the error.




Hello Jorge,

Do you always see the same message when starting the task?

The task records the last time it has run in the ‘task’ table (the ‘heartbeat’ column, as Unix timestamp). If the task hasn’t exited cleanly, the is_locked column is still set to 1. You can also see these parameters in the administration overview of TestRail. The is_locked column is automatically reset if needed when the task hasn’t run for a longer time but you could try to reset the is_locked column manually and retry to run the task.

Could you please email us a screenshot of your TestRail adminstration overview page to

Could you also please enable logging for the task by adding the following snippet to your config.php:

define(‘DEPLOY_DEBUG_TASK’, true);

This will add additional log messages to the log.