[midPoint] errorHandling controlFlow for tasks

Yakov Revyakin yrevyakin at gmail.com
Wed Mar 29 09:16:54 CEST 2023


Thank you Pavol,
>From the code I understand the same.
Only a question - so we have no configuration option supporting retry for
arbitrary tasks, correct? And, probably, this is possible only doing some
hand work with trigger API during script execution?

On Mon, 27 Mar 2023 at 10:47, Pavol Mederly via midPoint <
midpoint at lists.evolveum.com> wrote:

> Hello Yakov,
>
> actually, it is a limitation of the current implementation:
>
> " This mechanism is currently limited to synchronization tasks (import,
> reconciliation, live synchronization) "
>
> (in
> https://docs.evolveum.com/midpoint/reference/tasks/task-error-handling/#error-handling-in-4-3
> )
>
> I am going to update the documentation because it is out of date. But the
> limitation will still be there, as it is not trivial to overcome.
> (Technically, it is not easy to determine what action should be triggered
> on retry for arbitrary activities. The action is now simply "re-synchronize
> shadow". I see that - eventually - we should add a more clearer error
> message in such cases, pointing to the fact that that option is not
> supported for tasks outside synchronization ones.)
>
> Best regards,
>
> --
> Pavol Mederly
> Software developerevolveum.com
>
> On 26/03/2023 12:29, Yakov Revyakin via midPoint wrote:
>
> Playing with iterative scripting task and trying to move forward with
> retries I've found strange behavior in error handling.
> If Midpoint identifies a reaction as "retryLater" it tries to attach a
> trigger to *a shadow* object identified by OID of the object on which an
> exception is happening.
> For example, if an object is the "administrator" of UserType, Midpoint
> thinks that "00000000-0000-0000-0000-000000000002" is a shadow oid.
> In result there is an exception
> ERROR
> (com.evolveum.midpoint.repo.common.activity.run.ErrorHandlingStrategyExecutor):
> Couldn't create shadow synchronization trigger for shadow
> 00000000-0000-0000-0000-000000000002 -- live synchronization must stop.
>
> com.evolveum.midpoint.util.exception.ObjectNotFoundException: Object of
> type 'ShadowType' with OID '00000000-0000-0000-0000-000000000002' was not
> found.
>
> This happens in ErrorHandlingStrategyExecutor
>
> 2023-03-26 12:50:19,456 [REPOSITORY] [midPointScheduler_Worker-4] ERROR
> (com.evolveum.midpoint.repo.common.activity.run.ErrorHandlingStrategyExecutor):
> Couldn't create shadow synchronization trigger for shadow
> 00000000-0000-0000-0000-000000000002 -- live synchronization must stop.
>
> com.evolveum.midpoint.util.exception.ObjectNotFoundException: Object of
> type 'ShadowType' with OID '00000000-0000-0000-0000-000000000002' was not
> found.              at
> com.evolveum.midpoint.repo.sql.helpers.ObjectRetriever.throwObjectNotFoundException(ObjectRetriever.java:215)
>                                              at
> com.evolveum.midpoint.repo.sql.helpers.ObjectRetriever.getObjectInternal(ObjectRetriever.java:190)
>                                                         at
> com.evolveum.midpoint.repo.sql.helpers.ObjectUpdater.modifyObjectAttempt(ObjectUpdater.java:420)
>                                                           at
> com.evolveum.midpoint.repo.sql.SqlRepositoryServiceImpl.modifyObject(SqlRepositoryServiceImpl.java:576)
>                                                    at
> com.evolveum.midpoint.repo.cache.handlers.ModificationOpHandler.modifyObject(ModificationOpHandler.java:135)
>                                               at
> com.evolveum.midpoint.repo.cache.RepositoryCache.modifyObject(RepositoryCache.java:189)
>                                                                    at
> com.evolveum.midpoint.repo.cache.RepositoryCache.modifyObject(RepositoryCache.java:175)
>                                                                    at
> com.evolveum.midpoint.repo.cache.RepositoryCache.modifyObject(RepositoryCache.java:164)
>                                                                    at
> com.evolveum.midpoint.repo.common.activity.run.ErrorHandlingStrategyExecutor.createShadowSynchronizationTrigger(ErrorHandlingStrategyExecutor.java:209)
>
>
>          at *com.evolveum.midpoint.repo.common.activity.run.ErrorHandlingStrategyExecutor.processRetryLater(ErrorHandlingStrategyExecutor.java:185)
>                     at
> com.evolveum.midpoint.repo.common.activity.run.ErrorHandlingStrategyExecutor.executeErrorHandlingReaction(ErrorHandlingStrategyExecutor.java:163)
>          at *com.evolveum.midpoint.repo.common.activity.run.ErrorHandlingStrategyExecutor.handleError(ErrorHandlingStrategyExecutor.java:118)
>                           at
> com.evolveum.midpoint.repo.common.activity.run.IterativeActivityRun.handleError(IterativeActivityRun.java:641)
>
> It looks like a bug. What do you think?
>
>
> On Thu, 12 Jan 2023 at 13:23, Ivan Noris via midPoint <
> midpoint at lists.evolveum.com> wrote:
>
>> Could you try with iterative scripting instead?
>>
>> Activity (without error handling) with iterativeScripting example:
>>
>>
>>     <activity>
>>         <work>
>>             <iterativeScripting>
>>                 <objects>
>>                     <type>UserType</type>
>>                     <query>
>>                         <filter xmlns=
>> "http://prism.evolveum.com/xml/ns/public/query-3"
>> <http://prism.evolveum.com/xml/ns/public/query-3> xmlns:mext=
>> "http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
>> <http://midpoint.evolveum.com/xml/ns/public/model/extension-3>>
>>                             <ref>
>>                                 <path>archetypeRef</path>
>>                                 <value
>> oid="7135e68c-ee53-11e8-8025-170b77da3fd6"/>
>>                                 <!-- Employee Archetype -->
>>                             </ref>
>>                         </filter>
>>                     </query>
>>                 </objects>
>>                 <scriptExecutionRequest>
>>                     <s:action xmlns:s=
>> "http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"
>> <http://midpoint.evolveum.com/xml/ns/public/model/scripting-3>
>> xmlns:scext=
>> "http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3"
>> <http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3>>
>>                         <s:type>execute-script</s:type>
>>                         <s:parameter>
>>                             <s:name>script</s:name>
>>                             <c:value xmlns:xsi=
>> "http://www.w3.org/2001/XMLSchema-instance"
>> <http://www.w3.org/2001/XMLSchema-instance>
>> xsi:type="c:ScriptExpressionEvaluatorType">
>>                                 <c:code>
>>                         log.info('PRINTING OBJECT PROPERTIES: Name: {},
>> Given name: {}, Family name: {}',
>>                         input.getName(), input?.getGivenName(),
>> input?.getFamilyName())
>>                 </c:code>
>>                             </c:value>
>>                         </s:parameter>
>>                     </s:action>
>>                 </scriptExecutionRequest>
>>             </iterativeScripting>
>>         </work>
>>     </activity>
>>
>> Best regards,
>>
>> Ivan
>> On 12. 1. 2023 12:19, Yakov Revyakin wrote:
>>
>> <task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"      xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"      xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"      xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"      xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"      xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"      xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      oid="207e057f-d5fc-4523-ad76-ccf2401291ba"      version="91">    <name>Test CSV Downloader</name>    <assignment>        <targetRef oid="00000000-0000-0000-0000-000000000508" relation="org:default" type="c:ArchetypeType"/>    </assignment>    <executionState>runnable</executionState>    <schedulingState>ready</schedulingState>    <category>BulkActions</category>    <binding>loose</binding>    <schedule>        <recurrence>recurring</recurrence>        <interval>30</interval>        <misfireAction>reschedule</misfireAction>    </schedule>    <activity>        <work>            <nonIterativeScripting>                <scriptExecutionRequest xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3">                    <s:execute>                        <s:script>                            <code>                                throw new java.lang.Exception("Configuration error")
>>                             </code>                        </s:script>                        <s:forWholeInput>true</s:forWholeInput>                    </s:execute>                </scriptExecutionRequest>            </nonIterativeScripting>        </work>        <controlFlow>            <errorHandling>                <entry>                    <situation>                        <errorCategory>configuration</errorCategory>                        <status>fatal_error</status>                    </situation>                    <reaction>                        <retryLater>                            <initialInterval>PT1M</initialInterval>                            <nextInterval>PT1M</nextInterval>                            <retryLimit>3</retryLimit>                        </retryLater>                    </reaction>                </entry>            </errorHandling>        </controlFlow>    </activity></task>
>>
>>
>> On Thu, 12 Jan 2023 at 13:00, Yakov Revyakin <yrevyakin at gmail.com> wrote:
>>
>>> At least for 4.4.3 it doesn't work this way. My task includes
>>>
>>> <controlFlow>    <errorHandling>        <entry>            <situation>                <errorCategory>configuration</errorCategory>                <status>fatal_error</status>            </situation>            <reaction>                <retryLater>                    <initialInterval>PT1M</initialInterval>                    <nextInterval>PT1M</nextInterval>                    <retryLimit>3</retryLimit>                </retryLater>            </reaction>        </entry>    </errorHandling></controlFlow>
>>>
>>> But the task becomes suspended right after the first error. Status of
>>> the task becomes "Fatal Error"
>>> I have set enableExperimentalCode to true.
>>>
>>>
>>> On Thu, 12 Jan 2023 at 10:24, Ivan Noris via midPoint <
>>> midpoint at lists.evolveum.com> wrote:
>>>
>>>> Hi Yakov,
>>>>
>>>> have you tried
>>>>
>>>> https://docs.evolveum.com/midpoint/reference/tasks/task-error-handling/#triggers-2
>>>> example? Perhaps you are missing the errorCategory.
>>>>
>>>> Please see also the whole documentation page.
>>>>
>>>> As the feature is marked Experimental, you may have also hit some of
>>>> its
>>>> limits. I remember it worked according to the samples for Live sync
>>>> task
>>>> for sure.
>>>>
>>>> Best regards,
>>>>
>>>> Ivan
>>>>
>>>> On 11. 1. 2023 18:06, Yakov Revyakin via midPoint wrote:
>>>> > Hi all,
>>>> > It is not clear how to configure retry for a task.
>>>> > I have a task which got fatal_error because of an incorrect accessKey
>>>> > for an external resource. The task is suspended after the error.
>>>> > I'd like to have another behavior - task must retry attempt to
>>>> execute
>>>> > after a minute.
>>>> > I configured errorHandling in the activity section but still have the
>>>> > same result - the task is suspended after an error and there is any
>>>> > retry. What's wrong?
>>>> >
>>>> >     <activity>
>>>> >     .......
>>>> >         <controlFlow>
>>>> >             <errorHandling>
>>>> >                 <entry>
>>>> >                     <reaction>
>>>> >                         <retryLater>
>>>> > <initialInterval>PT1M</initialInterval>
>>>> > <nextInterval>PT3M</nextInterval>
>>>> > <retryLimit>3</retryLimit>
>>>> >                         </retryLater>
>>>> >                     </reaction>
>>>> >                 </entry>
>>>> >            </errorHandling>
>>>> >         </controlFlow>
>>>> >     </activity>
>>>> >
>>>> > _______________________________________________
>>>> > midPoint mailing list
>>>> > midPoint at lists.evolveum.com
>>>> > https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>
>>>> --
>>>> Ivan Noris
>>>> Expert Identity Engineer
>>>> evolveum.com
>>>>
>>>> _______________________________________________
>>>> midPoint mailing list
>>>> midPoint at lists.evolveum.com
>>>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>>>
>>> --
>> Ivan Noris
>> Expert Identity Engineerevolveum.com
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>
>
> _______________________________________________
> midPoint mailing listmidPoint at lists.evolveum.comhttps://lists.evolveum.com/mailman/listinfo/midpoint
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20230329/92b174d8/attachment-0001.htm>


More information about the midPoint mailing list