Project

General

Profile

Actions

Defect #2639

closed

Recalculation of automatic roles failed after synchronization of organizations (now it doesn't recalculate automatic roles)

Added by Alena Peterová over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Automatic roles
Target version:
Start date:
01/11/2021
Due date:
% Done:

100%

Estimated time:

Description

Version 10.6.4 without any customer module.

The recalculation of automatic roles by organizations failed after synchronization of organizations. Now some of the tasks are "Created", no other recalculations by tree structure are processed now.

Consequence: One identity has incorrect automatic roles, because its main position was moved in the tree structure and the roles weren't recalculated.


Situation:
  • One manually created tree node "xxxx-root" has 2 automatic roles by organization - "Role pro AD" and "WiFi XXX" with recursion DOWN
  • This tree node is used as root for all organizations synchronized from HR (https://wiki.czechidm.com/devel/documentation/synchronization/dev/tree-sync#how_to_synchronize_all_nodes_under_one_already_existing)
  • One of the organization, which has no parent in HR (so it's under "xxxx-root" in IdM), has 1 automatic role by organization with recursion DOWN. A lot of other organizations and identities are under this organization. Lets call it "HR root".
  • (maybe not important) There are 2 organization structures, only 1 is synchronized from HR. Some of the automatic roles are automatic for organizations in both structures.
What happened on 1.1.2021 - first problem with the synchronization:
  • Synchronization of organizations processed 86 Updates and 5 new organizations, 610 organizations were Update - Ignore (no change in HR). "HR root" was one of the unchanged items.
  • In the synchronization log, there is a message "01.01.2021 00:15:45: Warning - recalculation automatic role by attribute is not executed correctly."
  • The task ProcessSkippedAutomaticRoleByTreeTaskExecutor processed one automatic role as Executed and other automatic roles as "Failed". From that day, there are "Failed" items always:

    Detail of the first ProcessSkippedAutomaticRoleByTreeTaskExecutor items:
  • The task ProcessAutomaticRoleByTreeTaskExecutor was started 31 times that day, 10 instances are "Executed", 1 is "Waiting", 20 are "Created".

    Among the tasks ProcessAutomaticRoleByTreeTaskExecutor, there are only 3 different automatic roles by tree node.
    • The role, which is automatic for "HR root", is only once in the first Executed item. (this is not visible on the screenshot above)
    • The 2 roles, which are automatic for "xxxxx-root", are 15 times each (part of them are visible on the screenshot above)
What happens now:
  • There are many ProcessAutomaticRoleByTreeTaskExecutor LRTs in state "Created" and one "Waiting"
  • ProcessSkippedAutomaticRoleByTreeTaskExecutor is started every night and the processed items are all "Failed" due to "Concurrent task is already running".
  • Entity state agenda contains these "Blocked" flags:

If you need more details, please ask.


Error messages of the ProcessSkippedAutomaticRoleByTreeTaskExecutor items at 1.1.2021:
  • The blue "Failed" have the following error message:
    eu.bcvsolutions.idm.core.api.exception.AcceptedException: Concurrent task is already running. Task will be started asynchronously after concurrent task ends.
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.lambda$validate$2(AbstractLongRunningTaskExecutor.java:247)
    ...
    
  • The red "Failed" have the following error messages:
    eu.bcvsolutions.idm.core.api.exception.ResultCodeException: Processing task item for candidate [45938a76-f0ca-4169-ad77-0ee144cd0f56] ended with exception.
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.processItemInternal(AbstractSchedulableStatefulExecutor.java:350)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.access$000(AbstractSchedulableStatefulExecutor.java:62)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor$1.doInTransactionWithoutResult(AbstractSchedulableStatefulExecutor.java:284)
        at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:36)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.processCandidate(AbstractSchedulableStatefulExecutor.java:280)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.executeProcess(AbstractSchedulableStatefulExecutor.java:212)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.process(AbstractSchedulableStatefulExecutor.java:78)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.process(AbstractSchedulableStatefulExecutor.java:62)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.call(AbstractLongRunningTaskExecutor.java:262)
        at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultLongRunningTaskManager.executeSync(DefaultLongRunningTaskManager.java:392)
        at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultLongRunningTaskManager$$FastClassBySpringCGLIB$$3b41f3cc.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
        at eu.bcvsolutions.idm.core.scheduler.service.impl.DefaultLongRunningTaskManager$$EnhancerBySpringCGLIB$$ca6f1583.executeSync(<generated>)
        at eu.bcvsolutions.idm.acc.service.impl.TreeSynchronizationExecutor.executeAutomaticRoleRecalculation(TreeSynchronizationExecutor.java:708)
        at eu.bcvsolutions.idm.acc.service.impl.TreeSynchronizationExecutor.syncCorrectlyEnded(TreeSynchronizationExecutor.java:681)
        at eu.bcvsolutions.idm.acc.service.impl.TreeSynchronizationExecutor.process(TreeSynchronizationExecutor.java:157)
        at eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationService.startSynchronization(DefaultSynchronizationService.java:189)
        at eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationService$$FastClassBySpringCGLIB$$66d7ee75.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
        at eu.bcvsolutions.idm.acc.service.impl.DefaultSynchronizationService$$EnhancerBySpringCGLIB$$876a771e.startSynchronization(<generated>)
        at eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor.process(SynchronizationSchedulableTaskExecutor.java:71)
        at eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor.process(SynchronizationSchedulableTaskExecutor.java:31)
        at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.call(AbstractLongRunningTaskExecutor.java:262)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at eu.bcvsolutions.idm.core.config.DelegatingTransactionContextRunnable.run(DelegatingTransactionContextRunnable.java:39)
        at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:84)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: org.springframework.dao.EmptyResultDataAccessException: No class eu.bcvsolutions.idm.core.model.entity.IdmEntityState entity with id 45938a76-f0ca-4169-ad77-0ee144cd0f56 exists!
        at org.springframework.data.jpa.repository.support.SimpleJpaRepository.lambda$deleteById$0(SimpleJpaRepository.java:174)
        at java.util.Optional.orElseThrow(Optional.java:290)
    ...
    

Files


Related issues

Related to IdStory Identity Manager - Task #1043: Support skip recalculation for automatic roles by tree structure.ClosedRadek Tomiška03/27/2018

Actions
Actions #1

Updated by Radek Tomiška over 3 years ago

  • Status changed from New to In Progress
  • Target version set to 10.8.0
Actions #2

Updated by Radek Tomiška over 3 years ago

  • Related to Task #1043: Support skip recalculation for automatic roles by tree structure. added
Actions #3

Updated by Radek Tomiška over 3 years ago

  • Affected versions 10.4.0, 10.4.1, 10.4.2, 10.4.3, 10.4.4, 10.5.0, 10.5.1, 10.4.5, 10.4.6, 10.4.7, 10.5.2, 10.5.3, 10.4.8, 10.6.0, 10.4.9, 10.5.4, 10.6.1, 10.6.2, 10.6.3, 10.7.0, 10.7.1, 10.6.5 added
Actions #4

Updated by Radek Tomiška over 3 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Radek Tomiška to Vít Švanda
  • Target version changed from 10.8.0 to 10.7.2
  • % Done changed from 0 to 90

I was able to reproduce the issue - the entity states for the same automatic role (same owner) are deleted, when skipped automatic role is processed (~ optimization), which was not checked in ProcessSkippedAutomaticRoleByTreeTaskExecutor.

Fixed in commit:
https://github.com/bcvsolutions/CzechIdMng/commit/af99785e21756d2ffa571403d174e6d2665255f4

Could you provide me a feedback, please?

Note: As workaround or recover from state on project - cancel processing (waiting, created) skipped automatic roles (ProcessAutomaticRoleByTreeTaskExecutor), delete duplicate entity states (five from 10 in screenshot) and run ProcessSkippedAutomaticRoleByTreeTaskExecutor again.

Actions #5

Updated by Vít Švanda over 3 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 90 to 100

I did review and tested it. Works nice. Thnaks for that.

  • In the synchronization log, there is a message "01.01.2021 00:15:45: Warning - recalculation automatic role by attribute is not executed correctly."
    This warning may have been false positive. I fixed that:

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/d21176626b7434278afe49808674f66ebf4dd5c2

Actions #6

Updated by Radek Tomiška over 3 years ago

  • Status changed from Resolved to Closed

Thx, for improve log messages!

Actions #7

Updated by Radek Tomiška over 3 years ago

Merged into 10.6.6

Actions

Also available in: Atom PDF