Analytics Cron Job Failing

Hello Community,

We have an ongoing issue as shown in this thread here [Line Listing app - v100.0.0 / DHIS2v2.38] Error displaying data

We noticed in addition that the analytics CRON job has been failing. Every morning we now have to manually generate the analytics table

Below is the error message from 2 days ago

Click to view error message

Message: StatementCallback; bad SQL grammar [delete from “analytics_event_dergnr0f2d2” ax where ax.psi in (select psi.uid from programstageinstance psi inner join programinstance pi on psi.programinstanceid=pi.programinstanceid where pi.programid = 1223036 and psi.lastupdated >= ‘2022-07-16T14:08:28’ and psi.lastupdated < ‘2022-07-17T00:00:00’)]; nested exception is org.postgresql.util.PSQLException: ERROR: relation “analytics_event_dergnr0f2d2” does not exist Position: 13 Cause: org.postgresql.util.PSQLException: ERROR: relation “analytics_event_dergnr0f2d2” does not exist Position: 13 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse( at org.postgresql.core.v3.QueryExecutorImpl.processResults( at org.postgresql.core.v3.QueryExecutorImpl.execute( at org.postgresql.jdbc.PgStatement.executeInternal( at org.postgresql.jdbc.PgStatement.execute( at org.postgresql.jdbc.PgStatement.executeWithFlags( at org.postgresql.jdbc.PgStatement.executeCachedSql( at org.postgresql.jdbc.PgStatement.executeWithFlags( at org.postgresql.jdbc.PgStatement.execute( at com.mchange.v2.c3p0.impl.NewProxyStatement.execute( at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement( at org.springframework.jdbc.core.JdbcTemplate.execute( at org.springframework.jdbc.core.JdbcTemplate.execute( at at at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke( at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke( at java.base/java.lang.reflect.Method.invoke( at at org.springframework.aop.framework.JdkDynamicAopProxy.invoke( at com.sun.proxy.$Proxy314.removeUpdatedData(Unknown Source) at at at at org.hisp.dhis.scheduling.AbstractSchedulingManager.execute( at org.hisp.dhis.scheduling.AbstractSchedulingManager.execute( at org.hisp.dhis.scheduling.DefaultSchedulingManager.lambda$scheduleTask$3( at org.hisp.dhis.scheduling.DefaultSchedulingManager.lambda$runIfPossible$5( at at at java.base/java.util.concurrent.Executors$ at java.base/ at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker( at java.base/java.util.concurrent.ThreadPoolExecutor$ at java.base/

Please could you help us look into this?

We are running version 2.38.1.

Thank you.


1 Like

Hi @ifeanyiokoye

Tagging @netroms to check this please! We might need a Jira bug issue for this one.

From your other post, you are using 2.38.1. (adding this for reference)

Thank yoU!

1 Like

Thank you @Gassim

1 Like

Hello @ifeanyiokoye and @Gassim.

This seems to be a bug. It’s also reproducible in Play.
For more details, please see the Jira related to this issue: Log in - DHIS 2 JIRA

We will investigate it during the next few days.



Great. Thank you.

On this issue, I have a schedule job running for analytics at 1am daily. Data entry hasn’t happened on the system for a couple months so I was just doing some maintenance when I realized the job had failed for almost two months and I didn’t notice.

When I opened the job, it just said error and didn’t say what the error was. When I manually ran analytics it run successfully and the job now runs successfully daily since.

Is there a way to set up notifications in case of errors, because I might have noted sooner if was getting notifications for this.

1 Like

Note that the error stack trace above comes from an analytics query (e.g. sent from the dashboard or visualizer app) where the required analytics tables are not present.

If the analytics table generation process is failing, it would be useful to see the stack trace which is produced during the generation.



1 Like

@Lars How do we generate the stack trace?

1 Like

@ifeanyiokoye, the stack trace appears in the logs (Catalina.out) after running the export.