#1 2015-10-22 21:03:41

awilcox
Member
Registered: 2015-03-02
Posts: 40

PAMHook login script triggering OptimisticLockException

Hello,

We have a PAMHook login script that updates the Groups that the user logging in belongs to by first executing the following: userManagerService.getGroupByName(groupName)

Occasionally we are encountering OptimisticLockException from this call when multiple users are logging into ReportServer concurrently (stack trace below).

Do you have any suggestions as to how we could work around this issue? Is there some way to handle this exception within our login script?

Thanks,
Alana

2015-10-22 13:56:57,933 INFO  [ajp-bio-127.0.0.1-8009-exec-27] (CatchStacktraceInterceptor.java:53) - n.d.g.s.g.CatchStacktraceInterceptor - Intercepted NonFatalException
net.datenwerke.rs.scripting.service.scripting.exceptions.ScriptEngineException: javax.script.ScriptException: javax.script.ScriptException: javax.persistence.OptimisticLockException
        at net.datenwerke.rs.scripting.service.scripting.engines.GroovyEngine.eval(GroovyEngine.java:67) ~[rsscripting.jar:na]
        at net.datenwerke.rs.scripting.service.scripting.scriptservices.CallScriptService.exec(CallScriptService.java:61) ~[rsscripting.jar:na]
        at net.datenwerke.rs.scripting.service.scripting.scriptservices.GlobalsWrapper.exec(GlobalsWrapper.java:114) ~[rsscripting.jar:na]
        at net.datenwerke.rs.scripting.service.scripting.scriptservices.GlobalsWrapper$exec$4.call(Unknown Source) ~[na:na]
        at LdapPAM.authenticate(Script12.groovy:141) ~[na:na]
        at LdapPAM$authenticate$0.callCurrent(Unknown Source) ~[na:na]
        at LdapPAM.authenticate(Script12.groovy:78) ~[na:na]
        at net.datenwerke.security.service.authenticator.AuthenticatorServiceImpl.evaluateTokens(AuthenticatorServiceImpl.java:132) ~[dwsecurity.jar:na]
        at net.datenwerke.security.service.authenticator.AuthenticatorServiceImpl.authenticate(AuthenticatorServiceImpl.java:83) ~[dwsecurity.jar:na]
        at net.datenwerke.rs.authenticator.server.LoginHandlerImpl.authenticate(LoginHandlerImpl.java:60) ~[rsauthenticator.jar:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66) ~[guice-persist-3.0.jar:na]
        at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109) ~[dwsecurity.jar:na]
        at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38) ~[dwgwtframework.jar:na]
        at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561) ~[gwt-servlet-2.5.1.jar:na]
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) ~[gwt-servlet-2.5.1.jar:na]
        at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109) ~[dwsecurity.jar:na]
        at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38) ~[dwgwtframework.jar:na]
        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) ~[gwt-servlet-2.5.1.jar:na]
        at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) ~[gwt-servlet-2.5.1.jar:na]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) ~[tomcat-servlet-3.0-api.jar:na]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) ~[tomcat-servlet-3.0-api.jar:na]
        at net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109) ~[dwsecurity.jar:na]
        at net.datenwerke.gf.service.gwtstacktrace.CatchStacktraceInterceptor.invoke(CatchStacktraceInterceptor.java:38) ~[dwgwtframework.jar:na]
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) ~[guice-servlet-3.0.jar:na]
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) ~[guice-servlet-3.0.jar:na]
        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) ~[guice-servlet-3.0.jar:na]
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) [guice-servlet-3.0.jar:na]
        at com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:89) [guice-persist-3.0.jar:na]
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) [guice-servlet-3.0.jar:na]
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) [guice-servlet-3.0.jar:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.54]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.54]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.54]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.54]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [catalina.jar:7.0.54]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.54]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:7.0.54]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.54]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) [catalina.jar:7.0.54]
        at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193) [tomcat-coyote.jar:7.0.54]
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) [tomcat-coyote.jar:7.0.54]
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) [tomcat-coyote.jar:7.0.54]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_80]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_80]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.54]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80]
Caused by: javax.script.ScriptException: javax.script.ScriptException: javax.persistence.OptimisticLockException
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151) ~[groovy-all-2.4.3.jar:2.4.3]
        at net.datenwerke.rs.scripting.service.scripting.engines.GroovyEngine.eval(GroovyEngine.java:65) ~[rsscripting.jar:na]
        ... 50 common frames omitted
Caused by: javax.script.ScriptException: javax.persistence.OptimisticLockException
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:347) ~[groovy-all-2.4.3.jar:2.4.3]
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:145) ~[groovy-all-2.4.3.jar:2.4.3]
        ... 51 common frames omitted
Caused by: javax.persistence.OptimisticLockException: null
        at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1413) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1329) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
        at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:312) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
        at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getSingleResult(CriteriaQueryCompiler.java:258) ~[hibernate-entitymanager-4.2.2.Final.jar:4.2.2.Final]
        at net.datenwerke.rs.utils.simplequery.byatt.QueryByAttProcessor.process(QueryByAttProcessor.java:107) ~[rsserverutils.jar:na]
        at net.datenwerke.rs.utils.simplequery.byatt.QueryByAttInterceptor.invoke(QueryByAttInterceptor.java:24) ~[rsserverutils.jar:na]
        at net.datenwerke.security.service.usermanager.UserManagerService$getGroupByName$1.call(Unknown Source) ~[na:na]

Offline

Board footer

Powered by FluxBB