First Running Scheduler Task get No role access for process with same schedule and same execution supervisor role

Description

thanks to https://idempiere.atlassian.net/browse/IDEMPIERE-3380#icft=IDEMPIERE-3380 we were able identify an issue

steps to reproduce
1. create schedule for e.g. 1min in system
2. login to client 1 create new schedulers with same schedule and same execution supervisor role and different processes. (make sure supervisor role has right for both processes)
3. start server, watch log
4. log return error log - java.lang.IllegalStateException - "No role access for process ID"

12:16:31.356-----------> Scheduler.doWork: MProcess[1000024-Import File Storage Provider Loader] [75] java.lang.IllegalStateException: Nemáte oprávnenie pre proces 1,000,024 s Vašou rolou : Tenant Admin at org.compiere.model.MPInstance.setAD_Process_ID(MPInstance.java:223) at org.compiere.model.MPInstance.<init>(MPInstance.java:98) at org.compiere.server.Scheduler.runProcess(Scheduler.java:161) at org.compiere.server.Scheduler.doWork(Scheduler.java:118) at org.compiere.server.AdempiereServer.doRun(AdempiereServer.java:233) at org.compiere.server.AdempiereServer.run(AdempiereServer.java:212) at org.compiere.server.AdempiereServerMgr$ServerWrapper.run(AdempiereServerMgr.java:506) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Our testing result
processes running in separate trheads. when server starts and schedule task running - first time - then scheduler start to create process instance, then running role - getting access - hashmap is generated - for process access. both threads are accessing same hashmap, because of lack of hashmap sync between threads - in such cases - one of thread cant get process from hashmap. as result related scheduler is not running in this running.

Environment

None

Activity

Show:

Details

Assignee

Reporter

Tested By

Norbert Bede

Components

Priority

Created May 31, 2017 at 1:31 PM
Updated May 31, 2017 at 1:33 PM