Openbravo Issue Tracking System - Retail Modules
View Issue Details
0033323Retail ModulesCopy Retail Storepublic2016-06-21 17:042016-06-21 18:43
Asantos9 
Retail 
normalminoralways
newopen 
5
 
 
No
0033323: [SER QA 1333] Slow execution of Copy Store process might break the AlertActionHandler that manages the alert count
The backend does a call to the server every 50 seconds to refresh the alert count. If the copy store process is executing while this call happens the user can get a NullPointerException popup and the alert count stops updating with a JavaScript error. The copy store finishes OK. The alert count starts working again after reloading the application.
Error happens when the following line in the fixPersmissions() method has executed. but the organization is still not commited.
OBContext.getOBContext().addWritableOrganization(newStore.getId());

In this scenario if the AlertActionHandler is executed it tries to load the OBDal.getInstance().getReadableOrganizationsInClause() and when it tries to load the new organization by its id a null value is found which later throws the NullPointerException. The error can be reproduced consistently if a sleep of 50 seconds is set in the fixPermissions() method of copyStore() afred the addWritableOrganization() line.

java.lang.IllegalStateException: java.lang.NullPointerException
        at org.openbravo.client.application.AlertActionHandler.execute(AlertActionHandler.java:153)
        at org.openbravo.client.application.AlertActionHandler$Proxy$_$$_WeldClientProxy.execute(AlertActionHandler$Proxy$_$$_WeldClientProxy.java)
        at org.openbravo.client.kernel.KernelServlet.processActionRequest(KernelServlet.java:314)
        at org.openbravo.client.kernel.KernelServlet.doGet(KernelServlet.java:206)
        at org.openbravo.client.kernel.KernelServlet.doPost(KernelServlet.java:287)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
        at org.openbravo.base.HttpBaseServlet.serviceInitialized(HttpBaseServlet.java:228)
        at org.openbravo.base.secureApp.HttpSecureAppServlet.service(HttpSecureAppServlet.java:428)
        at org.openbravo.client.kernel.BaseKernelServlet.callServiceInSuper(BaseKernelServlet.java:88)
        at org.openbravo.client.kernel.BaseKernelServlet.service(BaseKernelServlet.java:59)
        at org.openbravo.client.kernel.KernelServlet.service(KernelServlet.java:168)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.openbravo.utils.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:66)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.openbravo.utils.CharsetFilter.doFilter(CharsetFilter.java:35)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.openbravo.client.kernel.KernelFilter$1.doAction(KernelFilter.java:62)
        at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
        at org.openbravo.client.kernel.KernelFilter.doFilter(KernelFilter.java:71)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.openbravo.dal.core.DalRequestFilter$1.doAction(DalRequestFilter.java:81)
        at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
        at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:103)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
        at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:868)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at org.openbravo.dal.core.OBContext.setReadableOrganizations(OBContext.java:583)
        at org.openbravo.dal.core.OBContext.getReadableOrganizations(OBContext.java:984)
        at org.openbravo.dal.service.OBDal.getReadableOrganizationsInClause(OBDal.java:553)
        at org.openbravo.client.application.AlertActionHandler.execute(AlertActionHandler.java:95)
        ... 48 more
Patch attached to reproduce the bug
Go to Copy Retail Store process
Fill the fields and click on Done

Note that executing the process a popup appear with a java.lang.NullPointerException
SER-QA
diff patchToReproduce.diff (745) 2016-06-21 17:04
https://issues.openbravo.com/file_download.php?file_id=9564&type=bug
Issue History
2016-06-21 17:04Asantos9New Issue
2016-06-21 17:04Asantos9Assigned To => Retail
2016-06-21 17:04Asantos9File Added: patchToReproduce.diff
2016-06-21 17:04Asantos9Triggers an Emergency Pack => No
2016-06-21 17:31daniOpenbravoTag Attached: SER-QA
2016-06-21 18:43VictorVillarSummarySlow execution of Copy Store process might break the AlertActionHandler that manages the alert count => [SER QA 1333] Slow execution of Copy Store process might break the AlertActionHandler that manages the alert count

There are no notes attached to this issue.