Project

General

Profile

Actions

Defect #2957

closed

When importing a business role which removes 2 subroles, only 1 is removed

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

Status:
Closed
Priority:
Low
Assignee:
Roman Kučera
Category:
Export Import
Target version:
Start date:
09/17/2021
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

Tested on 11.1.2
Steps to reproduce:
  • create a business role with 2 subroles (Subrole1, Subrole2)
  • export the role
  • add 2 more subroles (Subrole3, Subrole4)
  • import the role back
  • only one of the subroles is removed, the Subrole3 is still there. The second task RemoveRoleCompositionTaskExecutor ends with Warning
    Code: LONG_RUNNING_TASK_ACCEPTED
    Concurrent task is already running
    Task will be started asynchronously after concurrent task ends.

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:254)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.validate(AbstractLongRunningTaskExecutor.java:239)
    at eu.bcvsolutions.idm.core.scheduler.task.impl.RemoveRoleCompositionTaskExecutor.validate(RemoveRoleCompositionTaskExecutor.java:92)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.start(AbstractLongRunningTaskExecutor.java:162)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor.call(AbstractLongRunningTaskExecutor.java:263)
    at eu.bcvsolutions.idm.core.scheduler.api.service.AbstractLongRunningTaskExecutor$$FastClassBySpringCGLIB$$f9eae371.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:687)
    at eu.bcvsolutions.idm.core.scheduler.task.impl.RemoveRoleCompositionTaskExecutor$$EnhancerBySpringCGLIB$$f037167e.call(<generated>)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at eu.bcvsolutions.idm.core.config.DelegatingTransactionContextRunnable.run(DelegatingTransactionContextRunnable.java:39)
    at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:84)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Files

business_role_removal.png (38.8 KB) business_role_removal.png Alena Peterová, 09/17/2021 02:42 PM
business-role-with-2-subroles.zip (7.43 KB) business-role-with-2-subroles.zip Alena Peterová, 04/11/2022 11:40 AM
subroles_more_threads.png (190 KB) subroles_more_threads.png Alena Peterová, 04/11/2022 12:07 PM
Actions #1

Updated by Vít Švanda over 3 years ago

  • Target version set to 12.0.0
Actions #2

Updated by Radek Tomiška about 3 years ago

  • Target version changed from 12.0.0 to 12.1.0
Actions #3

Updated by Roman Kučera about 3 years ago

  • Target version changed from 12.1.0 to 12.2.0
Actions #4

Updated by Roman Kučera over 2 years ago

  • Status changed from New to In Progress
  • Assignee changed from Vít Švanda to Roman Kučera
Actions #5

Updated by Roman Kučera over 2 years ago

  • % Done changed from 0 to 50
I tested this on
  • 11.1.2
  • 11.2.1
  • 12.1.3

I was not able to replicate it in any of these versions. The subroles 3 and 4 were always correctly removed.
I tested it in appliance and on local env from IDE.

@apeterova Do you remember on which environment you discovered this behavior?

Actions #6

Updated by Roman Kučera over 2 years ago

  • % Done changed from 50 to 80
I did more testing:
  • Assign the main role to 50 users - the main role has 4 subroles
  • run import
  • Import removed 2 subroles and recalculates the business role.

So it seems everything is working.

Actions #7

Updated by Alena Peterová over 2 years ago

I simulated it again in my appliance at the first attempt. The main role is assigned to 2 users. The export/import is attached.
My appliance has 2 CPUs and 8 GB RAM.
Docker container: image: repo.iamappliance.com:8443/bcv-czechidm:11.2.1-r0

Apr 11 13:26:31 ... czechidm990: 2022-04-11 13:26:31.903 INFO 52332 --- [main] eu.bcvsolutions.idm.core.config.AsyncConfig.getAsyncExecutor : Task executor is initialized: corePoolSize [2], maxPoolSize [4], queueCapacity [20]

Actions #8

Updated by Alena Peterová over 2 years ago

This is most likely connected to the number of CPUs. When I increased it to 4 CPUs, the import was able to handle removal of 2 subroles. But when removing 4 subroles, only 2 were successful.
I tried it also for a main role which was not assigned to anybody.

Apr 11 13:57:05 idmsnt czechidm1026: 2022-04-11 13:57:05.204 INFO 45210 --- [main] eu.bcvsolutions.idm.core.config.AsyncConfig.getAsyncExecutor : Task executor is initialized: corePoolSize [4], maxPoolSize [8], queueCapacity [20]
Apr 11 13:58:30 idmsnt czechidm1026: 2022-04-11 13:58:30.433 INFO 130439 --- [main] eu.bcvsolutions.idm.core.config.AsyncConfig.eventExecutor : Event executor is initialized: corePoolSize [5], maxPoolSize [10], queueCapacity [50]

Actions #9

Updated by Roman Kučera over 2 years ago

  • % Done changed from 80 to 30

I limit my env in terms of assigned CPU and I am able to replicate this issue now.
Thx for testing.
Now I'll look into it and find some solution how to fix it.

Actions #10

Updated by Roman Kučera over 2 years ago

  • % Done changed from 30 to 60

I implemented fix in https://github.com/bcvsolutions/CzechIdMng/tree/kucerar/2957-concurent-role-composition-delete
Build on Github actions was ok.

The solution for now is to remove role composition always in synchronous mode. Need to discuss this solution if it's ok. Unfortunately better solution requires bigger changes in import/export or in RemoveRoleCompositionTaskExecutor itself

Actions #11

Updated by Roman Kučera over 2 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Roman Kučera to Tomáš Doischer
  • % Done changed from 60 to 80

We discuss this solution, at it should be ok.

PR https://github.com/bcvsolutions/CzechIdMng/pull/203

commit has wrong tiket number at the beginning....

@doischert can you please make a review?

Actions #12

Updated by Tomáš Doischer over 2 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Tomáš Doischer to Roman Kučera
  • % Done changed from 80 to 100

Thanks, LGTM. Merged to develop.

Actions #13

Updated by Roman Kučera over 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF