Przejdź do zawartości
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Sztuczna inteligencja
    • IoT
    • VoIP
    • Wiedza
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    • Program partnerski
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Odoo.sh 18.0 worker restart interrupts long-running background process

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
workerscronjobodoo18
1 Odpowiedz
18 Widoki
Awatar
RGonzalez
I have a background process running on Odoo.sh 18, but Odoo triggers a worker restart after just a few minutes, completely halting my process.

2026-08-26 20:34:03,381 113 INFO platco-test-37029683 odoo.service.server: Initiating shutdown

2026-08-26 20:34:03,381 113 INFO platco-test-37029683 odoo.service.server: Press CTRL-C again or send a second signal to force shutdown.

This causes my sessions, cursors, and data to be wiped, and the process begins to fail from that point on.

One apparent solution is to break the process into smaller chunks and use a cron job that runs frequently to capture the interruption point and resume where it left off; however, this creates several issues:

1. If I set it to run every minute, it might conflict with the previous execution and fail.
2. The recommended interval is 5 minutes. Using batches of 100 records (which seems to work best) for a total of 45,000+ records means spending over 225 minutes just waiting for cron executions. This is completely unfeasible for the client, especially since—to maintain consistency and integrity—I cannot allow records to be modified or created while the process is running (or at least, I believe I shouldn't).

I also wonder how the Import/Export process works; it can take half an hour depending on the number of records, yet it is never interrupted by this restart. I would appreciate any comments on this matter, as well as any recommendations you might offer to resolve my issue and allow the transaction to proceed to completion without being interrupted by the worker's meeting.

0
Awatar
Odrzuć
Awatar
Arpit Verma
Najlepsza odpowiedź

Yeah, I've hit this exact thing before. What's happening is your whole Odoo process is getting SIGTERM'd from outside, not one worker timing out. You can tell from the exact wording — "Initiating shutdown" only gets logged when the master process itself catches SIGINT/SIGTERM and starts tearing everything down. If it was Odoo's own CPU or real-time limit killing a worker, the log would say something like "CPU time limit reached" or "timeout after Xs," and only that one worker would die and get respawned — the rest of the server keeps running fine. What you've got is the container itself getting killed, which is why your cursors and sessions vanish all at once instead of just one request failing. Pull up the Logs tab on that branch and check what's logged right at 20:34:03, it'll usually line up with a build or deploy on that branch. That's your actual trigger, not a code-side timeout.

Also don't bother protecting against overlapping runs, that's already built in. ir.cron locks the row it's working on (FOR NO KEY UPDATE SKIP LOCKED), so if you set it to run every minute and the previous run's still going, it just gets skipped, not double-run. So the 5 minute interval was never buying you safety, it was just slowing you down for no reason.

The actual fix for your batching problem: Odoo 18 added a proper progress API to ir.cron that a lot of people haven't found yet. It didn't exist in 17. Instead of your cron method running once per interval, Odoo will now call it up to 10 times back to back in a single pass, committing in between each call, as long as your method reports progress with _notify_progress(done=X, remaining=Y). If there's still stuff left after those 10 rounds, it doesn't wait for the interval to come back around, it just marks itself ready again and gets picked up on the next poll, which is about 60 seconds, not 5 minutes. And if a worker dies mid-batch like yours is doing, it counts that as a timeout and retries automatically instead of just failing the whole job.

That's what fixes your 225 minute problem. 45k records at 100 per batch was 450 runs waiting 5 minutes apart. With this you get up to 1,000 records per minute-ish poll cycle, and it survives the restarts on its own instead of you babysitting where it left off.

def _cron_migrate_records(self):
    Model = self.env['my.model']
    domain = [('migration_state', '=', 'pending')]
    batch = Model.search(domain, limit=200, order='id')
    if not batch:
        self.env['ir.cron']._notify_progress(done=0, remaining=0)
        return
    for rec in batch:
        rec._do_migration_step()
    batch.write({'migration_state': 'done'})
    self.env.cr.commit()
    remaining = Model.search_count(domain)
    self.env['ir.cron']._notify_progress(done=len(batch), remaining=remaining)

Set the cron's own interval to daily or whatever, doesn't matter, then just call _trigger() once to kick it off. The progress loop does the rest on its own.

For the "records might change mid-run" thing, skip the table lock entirely, long locks on Odoo.sh just bite you later. Grab max(id) once when the run starts and filter every batch against that. Anything created or edited after that point just doesn't exist as far as this run's concerned, it'll get caught next time.

And to answer why import/export doesn't choke on this — same trick, different driver. execute_import takes a limit param and returns a batch flag when there's more rows left, so it's actually your browser firing off request after request behind the scenes, not one big call. Same batching idea, just the client's doing the looping instead of the cron scheduler.

If you outgrow even this — need retries with backoff, priority queues, a way to see what actually failed — grab OCA's queue_job, that's what it's for. SSH + tmux works too for a one-time migration, just remember it's sitting in the same container, so a branch restart takes that down exactly the same way, it's not actually safer.

0

Zaprenumeruj

Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Schedule Action code is not working in odoo 18 Rozwiązane
cronjob odoo18
Awatar
Awatar
1
lis 25
10680
Alternative to `numbercall` for Automated (Cron) Jobs (Scheduled Action) in Odoo 18 Rozwiązane
cronjob AutomatedActions ScheduledActions odoo18
Awatar
Awatar
1
paź 25
8794
? ParseError: field does not exist in XML view (Odoo 18) ?
odoo18
Awatar
0
lip 26
25
? Module upgrade fails with ParseError in XML
odoo18
Awatar
0
mar 26
3
Odoo18 - How to select Email Templates when sending multiple invoices
odoo18
Awatar
Awatar
1
lis 25
4498
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) Português română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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