<div dir="ltr">
Playing with iterative scripting task and trying to move forward with retries I've found strange behavior in error handling. <br><div>If Midpoint identifies a reaction as "retryLater" it tries to attach a trigger to <b>a shadow</b> object identified by OID of the object on which an exception is happening.</div><div>For example, if an object is the "administrator" of UserType, Midpoint thinks that "00000000-0000-0000-0000-000000000002" is a shadow oid.</div><div>In result there is an exception </div><div>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. </div><div>com.evolveum.midpoint.util.exception.ObjectNotFoundException: Object of type 'ShadowType' with OID '00000000-0000-0000-0000-000000000002' was not found.<br></div><div><br></div><div>This happens in ErrorHandlingStrategyExecutor<br><br></div><div>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 <b>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 </b>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)<br></div><div><br></div><div>It looks like a bug. What do you think?</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 12 Jan 2023 at 13:23, Ivan Noris via midPoint <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Could you try with iterative scripting instead?</p>
<p>Activity (without error handling) with iterativeScripting
example:</p>
<p><br>
</p>
<p> <activity><br>
<work><br>
<iterativeScripting><br>
<objects><br>
<type>UserType</type><br>
<query><br>
<filter
xmlns=<a href="http://prism.evolveum.com/xml/ns/public/query-3" target="_blank">"http://prism.evolveum.com/xml/ns/public/query-3"</a>
xmlns:mext=<a href="http://midpoint.evolveum.com/xml/ns/public/model/extension-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/model/extension-3"</a>><br>
<ref><br>
<path>archetypeRef</path><br>
<value
oid="7135e68c-ee53-11e8-8025-170b77da3fd6"/><br>
<!-- Employee Archetype --><br>
</ref><br>
</filter><br>
</query><br>
</objects><br>
<scriptExecutionRequest><br>
<s:action
xmlns:s=<a href="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"</a>
xmlns:scext=<a href="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3"</a>><br>
<s:type>execute-script</s:type><br>
<s:parameter><br>
<s:name>script</s:name><br>
<c:value
xmlns:xsi=<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>
xsi:type="c:ScriptExpressionEvaluatorType"><br>
<c:code><br>
<a href="http://log.info" target="_blank">log.info</a>('PRINTING OBJECT PROPERTIES:
Name: {}, Given name: {}, Family name: {}',<br>
input.getName(), input?.getGivenName(),
input?.getFamilyName())<br>
</c:code><br>
</c:value><br>
</s:parameter><br>
</s:action><br>
</scriptExecutionRequest><br>
</iterativeScripting><br>
</work><br>
</activity><br>
</p>
<p>Best regards,</p>
<p>Ivan<br>
</p>
<div>On 12. 1. 2023 12:19, Yakov Revyakin
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(232,191,106)"><task </span><span style="color:rgb(186,186,186)">xmlns</span><span style="color:rgb(106,135,89)">="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">c</span><span style="color:rgb(106,135,89)">="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">icfs</span><span style="color:rgb(106,135,89)">="<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">org</span><span style="color:rgb(106,135,89)">="<a href="http://midpoint.evolveum.com/xml/ns/public/common/org-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/common/org-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">q</span><span style="color:rgb(106,135,89)">="<a href="http://prism.evolveum.com/xml/ns/public/query-3" target="_blank">http://prism.evolveum.com/xml/ns/public/query-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">ri</span><span style="color:rgb(106,135,89)">="<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">t</span><span style="color:rgb(106,135,89)">="<a href="http://prism.evolveum.com/xml/ns/public/types-3" target="_blank">http://prism.evolveum.com/xml/ns/public/types-3</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">xsi</span><span style="color:rgb(106,135,89)">="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">oid</span><span style="color:rgb(106,135,89)">="207e057f-d5fc-4523-ad76-ccf2401291ba"
</span><span style="color:rgb(106,135,89)"> </span><span style="color:rgb(186,186,186)">version</span><span style="color:rgb(106,135,89)">="91"</span><span style="color:rgb(232,191,106)">>
</span><span style="color:rgb(232,191,106)"> <name></span>Test CSV Downloader<span style="color:rgb(232,191,106)"></name>
</span><span style="color:rgb(232,191,106)"> <assignment>
</span><span style="color:rgb(232,191,106)"> <targetRef </span><span style="color:rgb(186,186,186)">oid</span><span style="color:rgb(106,135,89)">="00000000-0000-0000-0000-000000000508" </span><span style="color:rgb(186,186,186)">relation</span><span style="color:rgb(106,135,89)">="org:default" </span><span style="color:rgb(186,186,186)">type</span><span style="color:rgb(106,135,89)">="c:ArchetypeType"</span><span style="color:rgb(232,191,106)">/>
</span><span style="color:rgb(232,191,106)"> </assignment>
</span><span style="color:rgb(232,191,106)"> <executionState></span>runnable<span style="color:rgb(232,191,106)"></executionState>
</span><span style="color:rgb(232,191,106)"> <schedulingState></span>ready<span style="color:rgb(232,191,106)"></schedulingState>
</span><span style="color:rgb(232,191,106)"> <category></span>BulkActions<span style="color:rgb(232,191,106)"></category>
</span><span style="color:rgb(232,191,106)"> <binding></span>loose<span style="color:rgb(232,191,106)"></binding>
</span><span style="color:rgb(232,191,106)"> <schedule>
</span><span style="color:rgb(232,191,106)"> <recurrence></span>recurring<span style="color:rgb(232,191,106)"></recurrence>
</span><span style="color:rgb(232,191,106)"> <interval></span>30<span style="color:rgb(232,191,106)"></interval>
</span><span style="color:rgb(232,191,106)"> <misfireAction></span>reschedule<span style="color:rgb(232,191,106)"></misfireAction>
</span><span style="color:rgb(232,191,106)"> </schedule>
</span><span style="color:rgb(232,191,106)"> <activity>
</span><span style="color:rgb(232,191,106)"> <work>
</span><span style="color:rgb(232,191,106)"> <nonIterativeScripting>
</span><span style="color:rgb(232,191,106)"> <scriptExecutionRequest </span><span style="color:rgb(186,186,186)">xmlns:</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(106,135,89)">="<a href="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/model/scripting-3</a>"</span><span style="color:rgb(232,191,106)">>
</span><span style="color:rgb(232,191,106)"> <</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(232,191,106)">:execute>
</span><span style="color:rgb(232,191,106)"> <</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(232,191,106)">:script>
</span><span style="color:rgb(232,191,106)"> <code>
</span><span style="color:rgb(232,191,106)"> </span>throw new java.lang.Exception("Configuration error")
<span style="color:rgb(232,191,106)"></code>
</span><span style="color:rgb(232,191,106)"> </</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(232,191,106)">:script>
</span><span style="color:rgb(232,191,106)"> <</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(232,191,106)">:forWholeInput></span>true<span style="color:rgb(232,191,106)"></</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(232,191,106)">:forWholeInput>
</span><span style="color:rgb(232,191,106)"> </</span><span style="color:rgb(152,118,170)">s</span><span style="color:rgb(232,191,106)">:execute>
</span><span style="color:rgb(232,191,106)"> </scriptExecutionRequest>
</span><span style="color:rgb(232,191,106)"> </nonIterativeScripting>
</span><span style="color:rgb(232,191,106)"> </work>
</span><span style="color:rgb(232,191,106)"> <controlFlow>
</span><span style="color:rgb(232,191,106)"> <errorHandling>
</span><span style="color:rgb(232,191,106)"> <entry>
</span><span style="color:rgb(232,191,106)"> <situation>
</span><span style="color:rgb(232,191,106)"> <errorCategory></span>configuration<span style="color:rgb(232,191,106)"></errorCategory>
</span><span style="color:rgb(232,191,106)"> <status></span>fatal_error<span style="color:rgb(232,191,106)"></status>
</span><span style="color:rgb(232,191,106)"> </situation>
</span><span style="color:rgb(232,191,106)"> <reaction>
</span><span style="color:rgb(232,191,106)"> <retryLater>
</span><span style="color:rgb(232,191,106)"> <initialInterval></span>PT1M<span style="color:rgb(232,191,106)"></initialInterval>
</span><span style="color:rgb(232,191,106)"> <nextInterval></span>PT1M<span style="color:rgb(232,191,106)"></nextInterval>
</span><span style="color:rgb(232,191,106)"> <retryLimit></span>3<span style="color:rgb(232,191,106)"></retryLimit>
</span><span style="color:rgb(232,191,106)"> </retryLater>
</span><span style="color:rgb(232,191,106)"> </reaction>
</span><span style="color:rgb(232,191,106)"> </entry>
</span><span style="color:rgb(232,191,106)"> </errorHandling>
</span><span style="color:rgb(232,191,106)"> </controlFlow>
</span><span style="color:rgb(232,191,106)"> </activity>
</span><span style="color:rgb(232,191,106)"></task>
</span></pre>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 12 Jan 2023 at 13:00,
Yakov Revyakin <<a href="mailto:yrevyakin@gmail.com" target="_blank">yrevyakin@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">At least for 4.4.3 it doesn't work this way. My
task includes<br>
<pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(232,191,106)"><controlFlow>
</span><span style="color:rgb(232,191,106)"> <errorHandling>
</span><span style="color:rgb(232,191,106)"> <entry>
</span><span style="color:rgb(232,191,106)"> <situation>
</span><span style="color:rgb(232,191,106)"> <errorCategory></span>configuration<span style="color:rgb(232,191,106)"></errorCategory>
</span><span style="color:rgb(232,191,106)"> <status></span>fatal_error<span style="color:rgb(232,191,106)"></status>
</span><span style="color:rgb(232,191,106)"> </situation>
</span><span style="color:rgb(232,191,106)"> <reaction>
</span><span style="color:rgb(232,191,106)"> <retryLater>
</span><span style="color:rgb(232,191,106)"> <initialInterval></span>PT1M<span style="color:rgb(232,191,106)"></initialInterval>
</span><span style="color:rgb(232,191,106)"> <nextInterval></span>PT1M<span style="color:rgb(232,191,106)"></nextInterval>
</span><span style="color:rgb(232,191,106)"> <retryLimit></span>3<span style="color:rgb(232,191,106)"></retryLimit>
</span><span style="color:rgb(232,191,106)"> </retryLater>
</span><span style="color:rgb(232,191,106)"> </reaction>
</span><span style="color:rgb(232,191,106)"> </entry>
</span><span style="color:rgb(232,191,106)"> </errorHandling>
</span><span style="color:rgb(232,191,106)"></controlFlow>
</span></pre>
<div>But the task becomes suspended right after the first
error. Status of the task becomes "Fatal Error"</div>
<div>I have set enableExperimentalCode to true. </div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 12 Jan 2023 at
10:24, Ivan Noris via midPoint <<a href="mailto:midpoint@lists.evolveum.com" target="_blank">midpoint@lists.evolveum.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Yakov,<br>
<br>
have you tried <br>
<a href="https://docs.evolveum.com/midpoint/reference/tasks/task-error-handling/#triggers-2" rel="noreferrer" target="_blank">https://docs.evolveum.com/midpoint/reference/tasks/task-error-handling/#triggers-2</a>
<br>
example? Perhaps you are missing the errorCategory.<br>
<br>
Please see also the whole documentation page.<br>
<br>
As the feature is marked Experimental, you may have also
hit some of its <br>
limits. I remember it worked according to the samples for
Live sync task <br>
for sure.<br>
<br>
Best regards,<br>
<br>
Ivan<br>
<br>
On 11. 1. 2023 18:06, Yakov Revyakin via midPoint wrote:<br>
> Hi all,<br>
> It is not clear how to configure retry for a task.<br>
> I have a task which got fatal_error because of an
incorrect accessKey <br>
> for an external resource. The task is suspended after
the error.<br>
> I'd like to have another behavior - task must retry
attempt to execute <br>
> after a minute.<br>
> I configured errorHandling in the activity section
but still have the <br>
> same result - the task is suspended after an error
and there is any <br>
> retry. What's wrong?<br>
><br>
> <activity><br>
> .......<br>
> <controlFlow><br>
> <errorHandling><br>
> <entry><br>
> <reaction><br>
> <retryLater><br>
> <initialInterval>PT1M</initialInterval><br>
> <nextInterval>PT3M</nextInterval><br>
> <retryLimit>3</retryLimit><br>
> </retryLater><br>
> </reaction><br>
> </entry><br>
> </errorHandling><br>
> </controlFlow><br>
> </activity><br>
><br>
> _______________________________________________<br>
> midPoint mailing list<br>
> <a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
> <a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br>
-- <br>
Ivan Noris<br>
Expert Identity Engineer<br>
<a href="http://evolveum.com" rel="noreferrer" target="_blank">evolveum.com</a><br>
<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
<pre cols="72">--
Ivan Noris
Expert Identity Engineer
<a href="http://evolveum.com" target="_blank">evolveum.com</a>
</pre>
</div>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote></div>