Konstanty Wubbufetowicz created CLOUDSTACK-9841: ---------------------------------------------------
Summary: Usage server transaction rolled back Key: CLOUDSTACK-9841 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9841 Project: CloudStack Issue Type: Bug Security Level: Public (Anyone can view this level - this is the default.) Components: Usage Affects Versions: 4.9.0, 4.9.2.0 Environment: CentOS 6.8, Mysql 5.6, Cloudstack 4.9.0 Reporter: Konstanty Wubbufetowicz Attachments: usage-logs.tgz While trying to generate usage records I am getting the following error at the end of the process. I also tested if this is happening with cloudstack-usage 4.9.2 (but with 4.9.0 management-server) - getting exactly the same issue. Might be related to https://issues.apache.org/jira/browse/CLOUDSTACK-6988 Steps to reproduce: I guess that must be something specific about my cloud database content. However, this is a production setup so I am rather not keen on sharing it... Desired results: Usage records created Actual results: javax.persistence.EntityExistsException: Entity already exists is thrown Stack trace: ERROR [cloud.usage.UsageManagerImpl] (Usage-Job-1:null) (logid:) Exception in usage manager javax.persistence.EntityExistsException: Entity already exists: at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1425) at com.cloud.usage.dao.UsageVMInstanceDaoImpl_EnhancerByCloudStack_3e9e482f.CGLIB$persist$32(<generated>) at com.cloud.usage.dao.UsageVMInstanceDaoImpl_EnhancerByCloudStack_3e9e482f_FastClassByCloudStack_33ae4cfc.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:122) at com.cloud.usage.dao.UsageVMInstanceDaoImpl_EnhancerByCloudStack_3e9e482f.persist(<generated>) at com.cloud.usage.UsageManagerImpl.populateDynamicComputeOfferingDetailsAndPersist(UsageManagerImpl.java:1245) at com.cloud.usage.UsageManagerImpl.createVMHelperEvent(UsageManagerImpl.java:1173) at com.cloud.usage.UsageManagerImpl.createHelperRecord(UsageManagerImpl.java:946) at com.cloud.usage.UsageManagerImpl.parse(UsageManagerImpl.java:628) at com.cloud.usage.UsageManagerImpl.runInContextInternal(UsageManagerImpl.java:384) at com.cloud.usage.UsageManagerImpl$1.runInContext(UsageManagerImpl.java:326) at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53) at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46) at com.cloud.usage.UsageManagerImpl.run(UsageManagerImpl.java:323) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '581-2-2017-01-09 16:27:16' for key 'vm_instance_id' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625) at com.mysql.jdbc.LoadBalancedMySQLConnection.execSQL(LoadBalancedMySQLConnection.java:155) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1390) ... 24 more (Full logfiles in the attachement) -- This message was sent by Atlassian JIRA (v6.3.15#6346)