Hi all, I am sharing here the result of an analysis that Nameet Jain and I did to figure out why, under some circumstances the same seca service was executed twice.
The problem is that, when a service is executed as "async" the secas attached to the "auth" and "in-validate" events are executed two times: at the time of the call and later at the time of execution. Here are the details: when you call a service using the async method the following events occur immediately (i.e. synchronously at the time of the call): 1) all SECAs with event="auth" are executed 2) the user authorization to call the service is checked 3) all SECAs with event="in-validate" are executed 4) the service input parameters are validated 5) the service is submitted for later execution (e.g. added to the JobSandbox) After some time, the job scheduler picks the job from the queue and then executes it with a *sync* call; at this point all the events that you would expect to be executed during a sync call occur: 1) all SECAs with event="auth" are executed 2) the user authorization to call the service is checked 3) all SECAs with event="in-validate" are executed 4) the service input parameters are validated 5) all SECAs with event="invoke" are executed 6) the service is executed 7) all SECAs with event="out-validate" are executed 8) the service output parameters are validated 9) all SECAs with event="return" are executed 10) there are also other SECAs that are scheduled for execution at transaction level; the ones with events: "commit", "global-commit", "global-commit-post-run", "global-rollback" As you can see the steps #1, #2, #3 and #4 are executed twice when the service is called with the runAsync method and specifically all the SECAs of events "auth" and "in-validate" are executed twice. Proposed fix: we could simply remove the execution of "auth" and "in-validate" secas when the async service is invoked, and defer their execution at the time the service is actually executed (i.e. picked from the queue and run). Any comments? Jacopo
