Project: usergrid
Issue USERGRID-406: HTTP POST of Entity fails under heavy load
When running UG2 under heavy we sometimes see the exception below when a new Entity is created by an HTTP POST. The problem seems to be that we write the Entity. Then when we add-to-collection and validate the Entity, we read the Entity but it is not ready for us to read yet -- so the read fails. Instead of re-reading the Entity, we should pass the Entity that we created down into the add-to-collection and validate methods. We should not need to read the Entity in the processing of the request that created it. java.lang.NullPointerException org.apache.usergrid.corepersistence.CpEntityManager.validate(CpEntityManager.java:856) org.apache.usergrid.corepersistence.CpEntityManager.validate(CpEntityManager.java:842) org.apache.usergrid.corepersistence.CpEntityManager.getDictionaryAsMap(CpEntityManager.java:1094) org.apache.usergrid.corepersistence.CpEntityManager.getDictionaryAsSet(CpEntityManager.java:1017) org.apache.usergrid.services.AbstractService.getConnectingTypesSet(AbstractService.java:505) org.apache.usergrid.services.AbstractService.importEntity(AbstractService.java:364) org.apache.usergrid.services.AbstractService.importEntity(AbstractService.java:333) org.apache.usergrid.services.AbstractCollectionService.postCollection(AbstractCollectionService.java:394) org.apache.usergrid.services.AbstractService.invokeCollection(AbstractService.java:720) org.apache.usergrid.services.AbstractService.invoke(AbstractService.java:634) org.apache.usergrid.services.AbstractService.invoke(AbstractService.java:544) org.apache.usergrid.services.ServiceRequest.execute(ServiceRequest.java:226) org.apache.usergrid.services.ServiceRequest.execute(ServiceRequest.java:193) org.apache.usergrid.rest.applications.ServiceResource.executeServiceRequest(ServiceResource.java:251) org.apache.usergrid.rest.applications.ServiceResource.executePost(ServiceResource.java:401) sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
Story points: 3