Hi Odoo Community,
I'm facing an issue while importing large datasets (e.g., thousands of records) using a cron job in Odoo, and this is specifically on Odoo.sh.
🧪 Scenario:
- I upload a large CSV file (with 5000+ records).
- A scheduled cron job runs every 5 minutes to process and create records in the database.
- After some time (usually mid-process), the cron crashes with this error:
psycopg2.InterfaceError: cursor already closed
🔍 Observations:
- The issue does not occur with small files (under 500 records).
- It seems to be related to long-running loops, likely causing the DB session or cursor to close unexpectedly.
- This happens consistently during large data operations on Odoo.sh and also in Local.
❓ My Questions:
- Why does the “cursor already closed” error occur during long cron executions in Odoo?
- Since I’m using Odoo.sh, I cannot modify server timeouts or configurations — what are the alternatives?
- What’s the best practice to safely process thousands of records in a cron job on Odoo.sh? and also in Local
Any help would be highly appreciated 🙏
Thanks in advance!
If you are using a shared server on odoo.sh then you can't run long batch jobs. As a dedicated odoo.sh server is very expensive you probably need to look at other hosting options which allow you to have more control.