Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Cursor closed error during large CSV import via cron job in Odoo.sh

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
databasecronjobodoo18odoo-developmentodoo-customization
1 Atsakyti
2050 Rodiniai
Portretas
Rushik Pitroda

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:
  1. Why does the “cursor already closed” error occur during long cron executions in Odoo?
  2. Since I’m using Odoo.sh, I cannot modify server timeouts or configurations — what are the alternatives?
  3. 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!

0
Portretas
Atmesti
Chris TRINGHAM

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.

Portretas
Christoph Farnleitner
Best Answer

You need to perform your import in smaller chunks.

We usually do this by just fetching a more reasonable number of lines from a large file and keep track of the last processed line once that chunk has been processed.

Now, by keeping track of the last record, you can utilize the ir.cron.trigger model. In here you would store the cron_id and a call_at datetime allowing you to continue with the next set of lines, once it's its turn.

This way you don't have to deal with manual cursor creation since each iteration of a cron task would just work on a limited number of records, safely process it, stop gracefully and the awaits the next trigger to run the cron task (starting from the last processed line + 1). This is logic you will have develop.

0
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
How to Set Decimal Accuracy for a Custom Float Field
odoo18 odoo17 odoo-development odoo-customization
Portretas
Portretas
1
birž. 25
1892
Schedule Action code is not working in odoo 18 Solved
cronjob odoo18
Portretas
Portretas
1
lapkr. 25
7495
🔍 Odoo 17 : How to Search Compute Fields Without store=True in Python (Backend)? Solved
computed-fields odoo-development odoo-customization
Portretas
Portretas
1
birž. 25
2070
Alternative to `numbercall` for Automated (Cron) Jobs (Scheduled Action) in Odoo 18 Solved
cronjob AutomatedActions ScheduledActions odoo18
Portretas
Portretas
1
spal. 25
6022
Is it safe to remove a module by deleting it from the addons directory along with all dependent modules?
database addons uninstall ir_model_fields odoo18
Portretas
Portretas
1
saus. 25
1866
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now