actframework / act-aaa-plugin

Use OSGL aaa library to mange Authentication/Authorization/Accounting for ActFramework Application
Apache License 2.0
6 stars 2 forks source link

It can load yaml content before AAA service is fully initialized #10

Closed greenlaw110 closed 7 years ago

greenlaw110 commented 7 years ago

Relevant source code:

image

Error stack:

2017-08-03 17:49:47,801 WARN  [jobs-thread-1] [act.job._Job] - error executing job act.aaa.AAAService$1@8476ea2
java.lang.NullPointerException: null
    at act.aaa.AAAService.loadPrivilege(AAAService.java:411)
    at act.aaa.AAAService.loadObject(AAAService.java:406)
    at act.aaa.AAAService.loadYamlContent(AAAService.java:385)
    at act.aaa.AAAService.loadYaml(AAAService.java:373)
    at act.aaa.AAAService.devLoadAcl(AAAService.java:139)
    at act.aaa.AAAService.loadAcl(AAAService.java:130)
    at act.aaa.AAAService.access$000(AAAService.java:46)
    at act.aaa.AAAService$1.run(AAAService.java:87)
    at act.job._Job$3.apply(_Job.java:354)
    at act.job._Job.doJob(_Job.java:312)
    at act.job._Job.run(_Job.java:251)
    at act.job._Job$LockableJobList.runSubJobs(_Job.java:97)
    at act.job._Job$LockableJobList.runSubJobs(_Job.java:78)
    at act.job._Job.runPrecedenceJobs(_Job.java:331)
    at act.job._Job.run(_Job.java:246)
    at act.job.AppJobManager$_AppEventListener.on(AppJobManager.java:379)
    at act.event.EventBus.callOn(EventBus.java:236)
    at act.event.EventBus.callOn(EventBus.java:260)
    at act.event.EventBus.callOn(EventBus.java:281)
    at act.event.EventBus.emit(EventBus.java:309)
    at act.event.EventBus.emit(EventBus.java:298)
    at act.app.App.emit(App.java:949)
    at act.app.App$3.run(App.java:644)
    at act.job._Job$3.apply(_Job.java:354)
    at act.job._Job.doJob(_Job.java:312)
    at act.job._Job.run(_Job.java:251)
    at act.job._Job$LockableJobList.runSubJobs(_Job.java:97)
    at act.job._Job$LockableJobList.runSubJobs(_Job.java:78)
    at act.job._Job.runPrecedenceJobs(_Job.java:331)
    at act.job._Job.run(_Job.java:246)
    at act.job.AppJobManager$_AppEventListener.on(AppJobManager.java:379)
    at act.event.EventBus.callOn(EventBus.java:236)
    at act.event.EventBus.callOn(EventBus.java:260)
    at act.event.EventBus.callOn(EventBus.java:281)
    at act.event.EventBus.emit(EventBus.java:309)
    at act.event.EventBus.emit(EventBus.java:298)
    at act.app.App.emit(App.java:949)
    at act.app.DbServiceManager$3.on(DbServiceManager.java:125)
    at act.app.DbServiceManager$3.on(DbServiceManager.java:119)
    at act.event.EventBus.callOn(EventBus.java:236)
    at act.event.EventBus.callOn(EventBus.java:260)
    at act.event.EventBus.callOn(EventBus.java:286)
    at act.event.EventBus.emit(EventBus.java:395)
    at act.db.sql.SqlDbService$1.run(SqlDbService.java:88)
    at act.db.sql.SqlDbService$1.on(SqlDbService.java:54)
    at act.event.EventBus.callOn(EventBus.java:236)
    at act.event.EventBus.access$100(EventBus.java:50)
    at act.event.EventBus$2.run(EventBus.java:268)
    at act.job.AppJobManager$ContextualJob$1.apply(AppJobManager.java:422)
    at act.job._Job.doJob(_Job.java:312)
    at act.job._Job.run(_Job.java:251)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
greenlaw110 commented 7 years ago

Root cause anlysis:

  1. It is doing AAAService intialization on PRE_START app event: image

  2. It tried to load yaml content on PRE_START app event: image

Thus it is really a random case controller which operation is done first. If an app initialize AAAService first, then it's lucky. If it is in a reversed order, then it will crash