Project

General

Profile

Actions

Defect #1840

closed

Duplicities in processed automatic roles and processed items from LongRunningTask

Added by Ondřej Kopr over 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Long running task
Target version:
-
Start date:
09/06/2019
Due date:
% Done:

0%

Estimated time:
Affected versions:
Owner:

Description

This defect mostly appears from version 9.3.0 to 9.7.5.

The error from long running task (eq. HrProcess) is throw when is checking older processed items. See the error:

java.lang.IllegalArgumentException: [Assertion failed] - this expression must be true
    at org.springframework.util.Assert.isTrue(Assert.java:68)
    at org.springframework.util.Assert.isTrue(Assert.java:80)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.removeFromProcessedQueue(AbstractSchedulableStatefulExecutor.java:110)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractSchedulableStatefulExecutor.lambda$executeProcess$0(AbstractSchedulableStatefulExecutor.java:189)

The processed items is created in same time:

The second error is thrown by ProcessAllAutomaticRoleByAttributeTaskExecutor. This task is started by daily synchronization. Task will process all automatic roles and remove or assign to users. In some cases can be newly added role assigned twice to same contract. This is problem throw the error:

org.springframework.dao.DataIntegrityViolationException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not extract ResultSet
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:263)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:225)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:436)
...
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService.getContractsForAutomaticRole(DefaultIdmAutomaticRoleAttributeService.java:314)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleAttributeService$$FastClassBySpringCGLIB$$4dda5ce1.invoke(<generated>)

...
Caused by: org.postgresql.util.PSQLException: ERROR: more than one row returned by a subquery used as an expression
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)

The fix that can solve this issue can be found in ticket #1822. If you want workaround by sql query:

Query for find duplicates in automatic roles:

select
    ir.id,
    ic.id,
    i.username,
    ir.created
from
    idm_identity_role ir
join idm_identity_contract ic on
    ic.id = ir.identity_contract_id
join idm_identity i on
    i.id = ic.identity_id
where
    ir.automatic_role_id in (
    select
        irr.automatic_role_id
    from
        idm_identity_role irr
    where
        irr.automatic_role_id is not null
        and irr.identity_contract_id = ir.identity_contract_id
    group by
        irr.automatic_role_id
    having
        count(*) > 1 );

Sql query for duplicates in processed items:

select
    referenced_entity_id,
    scheduled_task_queue_owner,
    count(*)
from
    idm_processed_task_item
where
    scheduled_task_queue_owner is not null 
group by
    referenced_entity_id,
    scheduled_task_queue_owner
having
    count(*) > 1;

Files

dupl.png (24.4 KB) dupl.png Ondřej Kopr, 09/06/2019 08:06 AM

Related issues

Related to IdStory Identity Manager - Defect #1822: HrEndContractProcess and HrEnableContractProcess process wrong items (some duplicate, some too late)ClosedRadek Tomiška08/26/2019

Actions
Related to IdStory Identity Manager - Defect #1961: Occasional duplicated automatic role assignment ClosedRadek Tomiška11/27/2019

Actions
Related to IdStory Identity Manager - Task #1968: Prevent to try assign duplicated automatic rolesNewRadek Tomiška11/29/2019

Actions
Actions #1

Updated by Radek Tomiška almost 5 years ago

  • Related to Defect #1822: HrEndContractProcess and HrEnableContractProcess process wrong items (some duplicate, some too late) added
Actions #2

Updated by Radek Tomiška almost 5 years ago

  • Related to Defect #1961: Occasional duplicated automatic role assignment added
Actions #3

Updated by Radek Tomiška almost 5 years ago

  • Related to Task #1968: Prevent to try assign duplicated automatic roles added
Actions #4

Updated by Radek Tomiška almost 5 years ago

  • Status changed from New to Rejected
  • Assignee changed from Ondřej Kopr to Radek Tomiška

Duplicate with #1961, where referential integrity was added. Final solution will be implemented here #1968.

Actions

Also available in: Atom PDF