Skip to content

Fix workflow service to handle coordinator and database errors - #4711

Merged
m4dcoder merged 14 commits into
masterfrom
orquesta-unhandled-errors
Jun 19, 2019
Merged

m4dcoder merged 14 commits into
masterfrom
orquesta-unhandled-errors

Conversation

@m4dcoder

@m4dcoder m4dcoder commented Jun 13, 2019 •

Copy link
Copy Markdown
Contributor

Add a separate retry decorator to handle coordinator and database connection errors different than the retry decorator for database write conflicts. Include the retry decorator at appropriate locations. The exception is raised again when retries are exhausted and the workflow engine process method catches the exception and fails the workflow execution. Add unit tests to test recovery from connection errors and when retries are exhausted. If the environmental errors persist and the workflow engine is unable to record the failed status for the workflow, add a garbage collection routine to cleanup these cases. Fixes #4704 and #4705.

@m4dcoder m4dcoder added the WIP label Jun 13, 2019
Refactor orquesta unit test test_error_handling to inherit from WorkflowTestCase. Move the sort_wf_runtime_errors function to WorkflowTestCase.
@m4dcoder
m4dcoder force-pushed the orquesta-unhandled-errors branch from 43e9e03 to 33555e1 Compare June 13, 2019 22:40
m4dcoder added 4 commits June 14, 2019 00:32
Add a check to ensure the scheduled items are in running state before canceling the execution. Otherwise, there could be a race where one of the item is not running and the status will be canceled instead of succeeded.
Add a separate retry decorator to handle coordinator and database connection errors different than the retry decorator for database write conflicts. Include the retry decorator at appropriate locations. Add unit tests to test recovery from connection errors and when retries are exhausted.
Ran make configgen to update the sample st2 config file to include the new workflow_engine options.
There is a conflict in registering config options in packs tests with the change in when test configs are parsed in st2tests.base.  Add a config reset in st2tests.base after st2common modules are loaded to avoid the conflict.
@m4dcoder
m4dcoder force-pushed the orquesta-unhandled-errors branch from 33555e1 to 0e437ec Compare June 14, 2019 00:44
m4dcoder added 2 commits June 14, 2019 04:56
When the process method of workflow engine failed with an unexpected error, catch the exception and fail the workflow execution.
Add jitter argument to the decorator for retrying from database write conflicts.
@m4dcoder m4dcoder removed the WIP label Jun 17, 2019
Add a step in the garbage collector to look for workflow orphans, workflow execution that has running status but have been idled without any task executions for some time. The garbage collector will cancel these workflow executions.  Add unit tests to make sure records are identified and canceled correctly.
@m4dcoder
m4dcoder force-pushed the orquesta-unhandled-errors branch from 8622fbd to 89fb1b5 Compare June 17, 2019 23:11
@m4dcoder
m4dcoder requested review from bigmstone and blag June 17, 2019 23:12
m4dcoder added 2 commits June 18, 2019 03:47
Use an indexed attribute workflow_execution instead of the workflow execution under the context. The fix uncovered other errors with client side sorting of the result. The fix for these errors are included.
Fix minor issue with use of the sorted method where the name of the "key" argument is not provided in the method call.
@Kami Kami added the mongodb label Jun 18, 2019
@Kami Kami added this to the 3.1.0 milestone Jun 18, 2019
m4dcoder added 3 commits June 18, 2019 19:53
If the message type is ActionExecutionDB and there is an exception on processing the message in the workflow engine, then fail the task execution associated with the action execution. This sets up the workflow execution to be able to rerun from failed task(s).
Add changelog entry for the workflow service fix to handle unexpected coordinator and database errors.
Clean up and normalize the log messages and how they are coded in the garbage collector.
@m4dcoder
m4dcoder merged commit 0b83322 into master Jun 19, 2019
@m4dcoder
m4dcoder deleted the orquesta-unhandled-errors branch June 19, 2019 19:17
@arm4b

arm4b commented Jul 4, 2019

Copy link
Copy Markdown
Member

Identified in internal st2cicd e2e tests infra.

With this newly introduced feature and default like:

# Max seconds to allow workflow execution be idled before it is identified as orphaned and cancelled by the garbage collector.
gc_max_idle_sec = 900

we're now marking long running orchestra workflows as canceled and stopping their execution.

This is pretty much a serious regression in just released v3.1 that will break existing workflow runs 😥 We'll likely need a patch release for this next week asap.

@arm4b arm4b removed this from the 3.1.0 milestone Jul 5, 2019
@arm4b arm4b modified the milestones: 3.1.1, 3.1.0 Jul 5, 2019
@arm4b

arm4b commented Jul 5, 2019

Copy link
Copy Markdown
Member

Addressed via #4733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VariableMessageQueueConsumer failed to process message error

4 participants