Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

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

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
databasecronjobodoo18odoo-developmentodoo-customization
1 Balas
2052 Tampilan
Avatar
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
Avatar
Buang
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.

Avatar
Christoph Farnleitner
Jawaban Terbai

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
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to Set Decimal Accuracy for a Custom Float Field
odoo18 odoo17 odoo-development odoo-customization
Avatar
Avatar
1
Jun 25
1894
Schedule Action code is not working in odoo 18 Diselesaikan
cronjob odoo18
Avatar
Avatar
1
Nov 25
7498
🔍 Odoo 17 : How to Search Compute Fields Without store=True in Python (Backend)? Diselesaikan
computed-fields odoo-development odoo-customization
Avatar
Avatar
1
Jun 25
2072
Alternative to `numbercall` for Automated (Cron) Jobs (Scheduled Action) in Odoo 18 Diselesaikan
cronjob AutomatedActions ScheduledActions odoo18
Avatar
Avatar
1
Okt 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
Avatar
Avatar
1
Jan 25
1866
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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