dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #15388
Re: scheduler error on 2.8: ERROR: update or delete on table "fileresource" violates foreign key constraint "fk_document_fileresourceid" on table "document"
Hi
Would you mind filling out a bug report at jira.dhis2.org ? including dhis
info, etc
--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Tue, Mar 13, 2018 at 10:56 AM, 林晓东 <lin_xd@xxxxxxx> wrote:
> hi,all
>
> I got this on everyday scheduling task:
>
> * ERROR 2018-03-13 02:00:01,349 ERROR: update or delete on table
> "fileresource" violates foreign key constraint "fk_document_fileresourceid"
> on table "document" . ( detail:Key (fileresourceid)=(4168592) is still
> referenced from table "document" SqlExceptionHelper.java [taskScheduler-1])
> * ERROR 2018-03-13 02:00:01,474 HHH000346: Error during managed flush
> [org.hibernate.exception.ConstraintViolationException: could not execute
> statement] (ExceptionMapperStandardImpl.java [taskScheduler-1])
> * ERROR 2018-03-13 02:00:01,538 Unexpected error occurred in scheduled
> task. (TaskUtils.java [taskScheduler-1])
> org.springframework.dao.DataIntegrityViolationException: could not
> execute statement; SQL [n/a]; constraint [fk_document_fileresourceid];
> nested exception is org.hibernate.exception.ConstraintViolationException:
> could not execute statement
> at org.springframework.orm.hibernate5.SessionFactoryUtils.conve
> rtHibernateAccessException(SessionFactoryUtils.java:241)
> at org.springframework.orm.hibernate5.HibernateTransactionManag
> er.convertHibernateAccessException(HibernateTransactionManager.java:755)
> at org.springframework.orm.hibernate5.HibernateTransactionManag
> er.doCommit(HibernateTransactionManager.java:594)
> at org.springframework.transaction.support.AbstractPlatformTran
> sactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
> at org.springframework.transaction.support.AbstractPlatformTran
> sactionManager.commit(AbstractPlatformTransactionManager.java:730)
> at org.springframework.transaction.interceptor.TransactionAspec
> tSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:
> 504)
> at org.springframework.transaction.interceptor.TransactionAspec
> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:292)
> at org.springframework.transaction.interceptor.TransactionInter
> ceptor.invoke(TransactionInterceptor.java:96)
> at org.springframework.aop.framework.ReflectiveMethodInvocation
> .proceed(ReflectiveMethodInvocation.java:179)
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
> JdkDynamicAopProxy.java:213)
> at com.sun.proxy.$Proxy607.deleteFileResource(Unknown Source)
> at org.hisp.dhis.fileresource.FileResourceCleanUpTask.lambda$
> run$198(FileResourceCleanUpTask.java:64)
> at java.util.ArrayList.forEach(ArrayList.java:1249)
> at org.hisp.dhis.fileresource.FileResourceCleanUpTask.run(FileR
> esourceCleanUpTask.java:62)
> at org.springframework.scheduling.support.DelegatingErrorHandli
> ngRunnable.run(DelegatingErrorHandlingRunnable.java:54)
> at org.springframework.scheduling.concurrent.ReschedulingRunnab
> le.run(ReschedulingRunnable.java:81)
> at java.util.concurrent.Executors$RunnableAdapter.call(
> Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFu
> tureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFu
> tureTask.run(ScheduledThreadPoolExecutor.java:293)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
> Executor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
> lExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: org.hibernate.exception.ConstraintViolationException: could
> not execute statement
> at org.hibernate.exception.internal.SQLStateConversionDelegate.
> convert(SQLStateConversionDelegate.java:112)
> at org.hibernate.exception.internal.StandardSQLExceptionConvert
> er.convert(StandardSQLExceptionConverter.java:42)
> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(Sql
> ExceptionHelper.java:111)
> at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(Sql
> ExceptionHelper.java:97)
> at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.execu
> teUpdate(ResultSetReturnImpl.java:208)
> at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.
> addToBatch(NonBatchingBatch.java:45)
> at org.hibernate.persister.entity.AbstractEntityPersister.delet
> e(AbstractEntityPersister.java:3315)
> at org.hibernate.persister.entity.AbstractEntityPersister.delet
> e(AbstractEntityPersister.java:3552)
> at org.hibernate.action.internal.EntityDeleteAction.execute(Ent
> ityDeleteAction.java:99)
> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQu
> eue.java:589)
> at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQu
> eue.java:463)
> at org.hibernate.event.internal.AbstractFlushingEventListener.p
> erformExecutions(AbstractFlushingEventListener.java:337)
> at org.hibernate.event.internal.DefaultFlushEventListener.onFlu
> sh(DefaultFlushEventListener.java:39)
> at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:
> 1435)
> at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.
> java:491)
> at org.hibernate.internal.SessionImpl.flushBeforeTransactionCom
> pletion(SessionImpl.java:3201)
> at org.hibernate.internal.SessionImpl.beforeTransactionCompleti
> on(SessionImpl.java:2411)
> at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.befor
> eTransactionCompletion(JdbcCoordinatorImpl.java:467)
> at org.hibernate.resource.transaction.backend.jdbc.internal.
> JdbcResource
> LocalTransactionCoordinatorImpl.beforeCompletionCallback(Jdb
> cResourceLocalTransactionCoordinatorImpl.java:146)
> at org.hibernate.resource.transaction.backend.jdbc.internal.
> JdbcResource
> LocalTransactionCoordinatorImpl.access$100(JdbcResourceLocal
> TransactionCoordinatorImpl.java:38)
> at org.hibernate.resource.transaction.backend.jdbc.internal.
> JdbcResource
> LocalTransactionCoordinatorImpl$TransactionDriverControlImpl
> .commit(JdbcResourceLocalTransactionCoordinatorImpl.java:220)
> at org.hibernate.engine.transaction.internal.TransactionImpl.
> commit(TransactionImpl.java:68)
> at org.springframework.orm.hibernate5.HibernateTransactionManag
> er.doCommit(HibernateTransactionManager.java:582)
> ... 20 more
> Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on
> table "fileresource" violates foreign key constraint
> "fk_document_fileresourceid" on table "document"
> . detail:Key (fileresourceid)=(4168592) is still referenced from table
> "document"
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorRespons
> e(QueryExecutorImpl.java:2476)
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(Quer
> yExecutorImpl.java:2189)
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecut
> orImpl.java:300)
> at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.
> java:428)
> at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
> at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgP
> reparedStatement.java:169)
> at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPrep
> aredStatement.java:136)
> at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUp
> date(NewProxyPreparedStatement.java:384)
> at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.execu
> teUpdate(ResultSetReturnImpl.java:205)
> ... 38 more
> * INFO 2018-03-13 02:00:02,460 'system-process' create
> org.hisp.dhis.datastatistics.DataStatistics, uid: OEs95wMjGdo
> (AuditLogUtil.java [taskScheduler-22])
> * INFO 2018-03-13 02:00:03,388 Saved data statistics snapshot
> (DataStatisticsTask.java [taskScheduler-22])
> * INFO 2018-03-13 05:00:00,009 Processing ProgramStageNotification
> messages: 00:00:00.000 (Clock.java [taskScheduler-11])
> * INFO 2018-03-13 05:00:00,044 Created and sent 0 messages in
> 00:00:00.034: 00:00:00.034 (Clock.java [taskScheduler-11])
>
> why? not the first time
>
> Thank.
>
>
> --
> 此致
>
> 林晓东
>
> 莫愁前路无知己,天下谁人不识君。
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help : https://help.launchpad.net/ListHelp
>
>
References