-
Bug
-
Resolution: Cannot Reproduce
-
Medium
-
None
-
Insight 8.9.1
-
10
-
Severity 3 - Minor
-
1
-
Issue Summary
Unable to delete an Object Schema/Object Type/Objects (Intermittent)
Steps to Reproduce
- Create an object schema with objects and attributes (with inbound or outbound references)
- Navigate to manage object schema page and try to delete the above schema or an object type with many objects, or bulk delete many objects
Expected Results
Object schema/object type/objects can be deleted
Actual Results
Object schema/object type/objects can not be deleted and an error message pops up
The below exception is thrown in the log file:
org.postgresql.util.PSQLException: ERROR: update or delete on table "AO_8542F1_IFJ_OBJ_TYPE" violates foreign key constraint "fk_ao_8542f1_ifj_obj_type_parent_object_type_id" on table "AO_8542F1_IFJ_OBJ_TYPE"org.postgresql.util.PSQLException: ERROR: update or delete on table "AO_8542F1_IFJ_OBJ_TYPE" violates foreign key constraint "fk_ao_8542f1_ifj_obj_type_parent_object_type_id" on table "AO_8542F1_IFJ_OBJ_TYPE" Detail: Key (ID)=(254) is still referenced from table "AO_8542F1_IFJ_OBJ_TYPE".com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:Database: - name:PostgreSQL - version:9.6.15 - minor version:6 - major version:9Driver: - name:PostgreSQL JDBC Driver - version:42.2.18org.postgresql.util.PSQLException: ERROR: update or delete on table "AO_8542F1_IFJ_OBJ_TYPE" violates foreign key constraint "fk_ao_8542f1_ifj_obj_type_parent_object_type_id" on table "AO_8542F1_IFJ_OBJ_TYPE" Detail: Key (ID)=(254) is still referenced from table "AO_8542F1_IFJ_OBJ_TYPE". at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.delete(EntityManagedActiveObjects.java:120) at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.delete(TenantAwareActiveObjects.java:282) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy3075.delete(Unknown Source) at com.riadalabs.jira.plugins.insight.services.core.dal.dao.impl.InsightActiveObject.delete(InsightActiveObject.java:78) at com.riadalabs.jira.plugins.insight.services.core.dal.dao.impl.ObjectTypeDaoImpl.deleteObjectTypeAO(ObjectTypeDaoImpl.java:139) at com.riadalabs.jira.plugins.insight.services.core.dal.impl.ConfigurationDalImpl.deleteObjectType(ConfigurationDalImpl.java:689) at com.riadalabs.jira.plugins.insight.services.core.ObjectTypeServiceImpl.deleteObjectType(ObjectTypeServiceImpl.java:546) at com.riadalabs.jira.plugins.insight.services.core.ObjectTypeDeletionServiceImpl.deleteObjectType(ObjectTypeDeletionServiceImpl.java:47) at com.riadalabs.jira.plugins.insight.services.core.ObjectSchemaDeletionServiceImpl.deleteObjectSchema(ObjectSchemaDeletionServiceImpl.java:42) at com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.objectschema.ObjectSchemaResource.deleteObjectSchema(ObjectSchemaResource.java:359) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) ... 19 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:160) ... 1 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:70) ... 32 filtered at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:55) ... 8 filtered at com.atlassian.jira.plugin.mobile.web.filter.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:59) ... 4 filtered at com.atlassian.jira.plugin.mobile.login.MobileLoginSuccessFilter.doFilter(MobileLoginSuccessFilter.java:54) ... 3 filtered at com.atlassian.diagnostics.internal.platform.monitor.http.HttpRequestMonitoringFilter.doFilter(HttpRequestMonitoringFilter.java:55) ... 8 filtered at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21) ... 43 filtered at com.atlassian.ratelimiting.internal.filter.RateLimitFilter.doFilter(RateLimitFilter.java:73) ... 3 filtered at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46) ... 17 filtered at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66) ... 1 filtered at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64) ... 16 filtered at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:38) ... 3 filtered at com.atlassian.pats.web.filter.TokenBasedAuthenticationFilter.doFilter(TokenBasedAuthenticationFilter.java:83) ... 19 filtered at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30) ... 5 filtered at com.atlassian.plugins.authentication.impl.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70) ... 3 filtered at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:215) at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:136) at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:89) at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:47) at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:206) at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:134) at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:123) ... 4 filtered at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37) ... 8 filtered at com.atlassian.ratelimiting.internal.filter.RateLimitPreAuthFilter.doFilter(RateLimitPreAuthFilter.java:71) ... 3 filtered at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21) ... 4 filtered at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46) ... 3 filtered at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36) ... 26 filtered at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25) ... 25 filtered at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "AO_8542F1_IFJ_OBJ_TYPE" violates foreign key constraint "fk_ao_8542f1_ifj_obj_type_parent_object_type_id" on table "AO_8542F1_IFJ_OBJ_TYPE" Detail: Key (ID)=(254) is still referenced from table "AO_8542F1_IFJ_OBJ_TYPE". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164) at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98) at com.atlassian.jira.ofbiz.sql.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:47) at com.atlassian.jira.diagnostic.connection.DiagnosticPreparedStatement.lambda$executeUpdate$7(DiagnosticPreparedStatement.java:69) at com.atlassian.diagnostics.internal.platform.monitor.db.DefaultDatabaseDiagnosticsCollector.recordExecutionTime(DefaultDatabaseDiagnosticsCollector.java:70) at com.atlassian.jira.diagnostic.connection.DatabaseDiagnosticsCollectorDelegate.recordExecutionTime(DatabaseDiagnosticsCollectorDelegate.java:55) at com.atlassian.jira.diagnostic.connection.DiagnosticPreparedStatement.executeUpdate(DiagnosticPreparedStatement.java:69) at net.java.ao.ForwardingPreparedStatement.executeUpdate(ForwardingPreparedStatement.java:45) at net.java.ao.ParameterMetadataCachingPreparedStatement.executeUpdate(ParameterMetadataCachingPreparedStatement.java:10) at net.java.ao.EntityManager.delete(EntityManager.java:541) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.delete(EntityManagedActiveObjects.java:118) ... 321 more
Workaround
Assuming there's at least one corrupted object type causing the failure to delete the schema, follow the steps in Cannot Delete Object Types on Insight Asset Management due to database constraint violation exception to identify and remove the corrupted object type before the attempt to delete the schema again. Contact support if the steps have been followed but the issue persists.