When running the Post Timesheets job in a system with a high volume of approved timesheets (e.g., 10,000+ timesheets with 4-5 entries each), the job fails quickly (typically within 3 minutes) with a Java heap space error.
Steps to Reproduce:
- Ensure the system has 10,000+ approved timesheets for a previous time period.
- Each timesheet should have at least 4-5 time entries.
- Execute the Post Timesheets job.
Expected Results :- Job Completes.
Actual Results :- Job is stuck in Process state but bg-ca.log shows the following error.
ERROR <timestamp> [Dispatch Post Timesheets : bg@XXXXX (tenant=clarity)]
org.postgresql.util.PSQLException: Ran out of memory retrieving query results.
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2383)
...
Caused by: java.lang.OutOfMemoryError: Java heap space