Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

Self hosted: How can I get Odoo 18 Real-time Chat Working? (Requires Refresh) & Recurring ir_cron Lock Errors in Multi-DB Docker Setup

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
authenticationdatabaseemailpostgresqlrealtimefetchingconcurrencyDockerdiscussCaddyfilelongpollingodoo18multidatabasemulti-instancetroubleshootingDockerComposeWebsocketsir_cronRuntimeErrorOrderedDict
1 ตอบกลับ
4815 มุมมอง
อวตาร
Ramon Rios

Persistent Real-time Chat (Longpolling) & ir_cron Lock Errors

Subject: Odoo 18 Real-time Chat Not Working (Requires Refresh) & Recurring ir_cron Lock Errors in Multi-DB Docker Setup

Odoo Version: 18.0 (Community Edition) Deployment: Docker Compose on Ubuntu Server 20.04.6 LTS Reverse Proxy: Caddy Database: PostgreSQL 15 (Docker container) Issue Type: Real-time communication (longpolling/websockets) and database contention (ir_cron locks)

Problem Description:

We are experiencing two persistent and critical issues with our Odoo 18 setup, which runs multiple Odoo databases (one per domain) on a single live18-odoo Docker container connected to a shared live18-db PostgreSQL container:

  1. OdooBot/Discuss Real-time Chat Not Working:
    • When chatting with OdooBot or in Discuss channels, replies and new messages do not appear in real-time. The page must be manually refreshed to see new content.
    • Direct access via http://144.126.135.5:18069 (bypassing Caddy/SSL) still shows "Real-time connection lost...", confirming the issue is internal to Odoo.
  2. Recurring ir_cron Database Lock Errors (Root Cause Identified):
    • We frequently observe ERROR: could not obtain lock on row in relation "ir_cron" in our PostgreSQL logs, specifically for id IN (6) ("Mail: Fetchmail Service").
    • CRITICAL NEW FINDING: Odoo logs also show RuntimeError: OrderedDict mutated during iteration. This error occurs when Odoo's cron system tries to loop through its list of active databases, but that list unexpectedly changes or becomes unstable. This is the root cause of the ir_cron locking errors and indicates fundamental instability in Odoo's multi-database management for cron jobs.
    • This database registry instability leads to cron job failures, memory spikes, and general Odoo unresponsiveness.

Server and Odoo Configuration Details:

  • Server IP: 144.126.135.5
  • Odoo Docker Compose (~/docker-apps/odoo18/live18/docker-compose.yml): Standard setup with Odoo 18, PostgreSQL 15, exposing ports 18069 (main) and 18072 (longpolling). Uses ODOO_PROXY_MODE=True and ODOO_DB_FILTER=^%h$.
  • Odoo Configuration (~/docker-apps/odoo18/live18/config/odoo.conf): log_level = debug, longpolling_port = 8072, workers = 4, max_cron_threads = 2, proxy_mode = True, dbfilter = ^%h$. web.base.url is not frozen.
  • Caddy Configuration: Standard setup for Odoo 18, proxying to 18069 and 18072 with necessary headers for websockets/longpolling.
  • Firewall (UFW): Ports 80, 443, 18069, 18072 are ALLOW IN. Mail ports (993, 995, 465, 587) are ALLOW OUT.
  • Cloudflare: A/CNAME records for web traffic are Proxied (orange cloud). Mail-related records are DNS Only (grey cloud). SSL/TLS is "Full". No custom WAF rules.
[options]
admin_passwd = ##################
; # Database connection details are set via environment variables in docker-compose.yml
; # Addons paths - Explicitly list subdirs like old server + Odoo standard path
addons_path = /mnt/extra-addons, /mnt/extra-addons/odooapps/, /mnt/extra-addons/industry/, /mnt/extra-addons/CybroAddons/, /mnt/extra-addons/social,/usr/lib/python3/dist-packages/odoo/addons
http_timeout = 1800
logfile = /var/log/odoo/odoo-server.log
logrotate = True
log_level = debug
longpolling_port = 8072
session_store = db
workers = 4
max_cron_threads = 2
proxy_mode = True
dbfilter = ^%h$
; # Database Connection Pool
;db_maxconn = 95
;web.base.url = https://coqui.cloud  ; <--- ADD/ENSURE THIS LINE (use your primary domain)
;web.base.url.freeze = True

Troubleshooting Steps Attempted and Ruled Out:

  • Caddy Configuration: Extensive testing and multiple Caddyfile iterations (including adding timeouts, explicit websocket directives) did not resolve the longpolling issue and sometimes caused Caddy to crash. Ruled out as primary cause.
  • Browser Caching: Hard refresh and clearing browser cache/cookies. Ruled out.
  • SSL/TLS Issues (from Caddy or Cloudflare): Direct HTTP access to Odoo's port 18069 still shows the longpolling issue. Ruled out.
  • Nginx/Nginx Proxy Manager: Attempts to switch were unsuccessful due to setup issues. Ruled out for now.
  • Odoo 15 Instances: Odoo 15 instances with similar Caddy configs work perfectly for real-time chat. Suggests issue is specific to Odoo 18.

Remaining Unresolved Issues & Hypotheses:

  1. RuntimeError: OrderedDict mutated during iteration (Root Cause of Cron Instability):
    • This is the most critical server-side error. It's a fundamental issue in Odoo's multi-database registry management.
    • Hypothesis: Likely a bug in Odoo 18's core or a specific module interaction causing database registry instability when cron threads iterate.
    • Specific Symptom: "Multiple password values not supported" from mail server logs for Fetchmail authentication, even after manual password re-typing and with empty mailboxes. This indicates Fetchmail is failing in an unusual way.
  2. Odoo 18 Real-time Chat Issue (Longpolling):
    • Hypothesis: Problem is definitively internal to Odoo 18's core longpolling/bus mechanism. Could be a subtle bug in Odoo 18's real-time stack, a conflict with a specific Odoo 18 module, or an interaction with its worker management when dbfilter is active. Logs at debug level show no errors, making diagnosis difficult.

Questions for the Community:

  1. For the RuntimeError: OrderedDict mutated during iteration: What are common causes and fixes for this specific Odoo error in multi-database setups (especially with dbfilter=^%h$)? Are there known Odoo 18 bugs or specific module interactions that cause this?
  2. For the Odoo 18 Real-time Chat issue: Given it's internal to Odoo and not Caddy/network, what are common causes for "Real-time connection lost..." when longpolling_port is listening and debug logs show no errors? Are there specific Odoo 18 modules known to interfere with bus or longpolling?
  3. For "Multiple password values not supported" (from mail server): What could cause Odoo 18 to send multiple password values during IMAP/POP3 authentication, even after manual re-typing and with simple passwords?

Any help or insights would be greatly appreciated. Thank you!

0
อวตาร
ละทิ้ง
อวตาร
Ramon Rios
ผู้เขียน คำตอบที่ดีที่สุด

After an extensive and challenging troubleshooting journey, I wanted to share the solutions we found for the persistent real-time chat issues and ir_cron database lock errors in our Odoo 18 multi-database Docker setup.

This was a complex problem with several interconnected root causes, but we've successfully stabilized the system.

Summary of the Problems:

  1. Real-time Chat (OdooBot/Discuss) Not Working: Messages required manual refresh.
  2. Recurring ir_cron Database Lock Errors: PostgreSQL logs showed ERROR: could not obtain lock on row in relation "ir_cron".
  3. Root Cause of ir_cron Errors: RuntimeError: OrderedDict mutated during iteration in Odoo logs, indicating database registry instability during cron job execution in a multi-database environment.

Solutions Found:

1. Fixing RuntimeError: OrderedDict mutated during iteration and ir_cron Locks (Server Stability)

This was the most critical server-side issue. The OrderedDict mutated error caused cron jobs to crash and hold database locks.

  • Diagnosis: The error occurred when Odoo's cron system iterated through active databases, and the registry unexpectedly changed. This was exacerbated by multiple problematic cron jobs (like Fetchmail and Sitemap generation) trying to run.
  • Solution:
    1. Deactivated ALL non-essential scheduled actions (cron jobs) in Odoo across all instances (e.g., "Mail: Fetchmail Service", "Create sitemap", "Recurring Invoice"). This was crucial to stop the OrderedDict mutation and ir_cron locks.
    2. Increased limit_time_real_cron in odoo.conf: Initially set to 2 seconds, which was too aggressive. Increasing it to 120 seconds (2 minutes) allowed cron jobs more time to complete without timing out.
      • odoo.conf setting: limit_time_real_cron = 120
    3. Systematic Reactivation: After achieving global stability (no errors with all non-essential cron jobs off), we systematically reactivated them one by one, troubleshooting specific mail server issues (e.g., "Multiple password values not supported" from mail server logs, which was a symptom of Fetchmail getting stuck) as they arose.
  • Result: The RuntimeError: OrderedDict mutated during iteration and ir_cron locking errors are now gone. The database is stable.

2. Fixing Odoo 18 Real-time Chat (Longpolling/WebSockets)

The real-time chat issue was internal to Odoo 18, not related to Caddy's basic proxying or network exposure.

  • Diagnosis:
    1. Direct IP Access Test: Accessing Odoo directly via http://144.126.135.5:18069 (bypassing Caddy/SSL) still showed "Real-time connection lost...", confirming the issue was Odoo-internal.
    2. GeoIP Crash: Odoo logs showed ValueError: '{http.request.remote.ip}' does not appear to be an IPv4 or IPv6 address. leading to KeyError: 'ir.http'. This happened because Caddy was passing a literal string instead of the actual client IP.
    3. Odoo 15 vs. Odoo 18: Odoo 15 instances worked, suggesting Odoo 18 had different requirements.
  • Solution:
    1. Corrected Caddy header_up directives: To pass the actual client IP from Cloudflare.
      • In Caddyfile, for both main and /websocket proxy blocks: header_up X-Real-IP {http.request.header.Cf-Connecting-Ip} header_up X-Forwarded-For {http.request.header.Cf-Connecting-Ip}
    2. Applied Comprehensive odoo.conf settings: This was the crucial step for Odoo 18's real-time stack.
      • odoo.conf settings (ensure these are present and active):
[options]
admin_passwd = ############
addons_path = /mnt/extra-addons,/usr/lib/python3/dist-packaes/odoo/addons
session_store = db
session_dir = False
limit_memory_hard = 2415919104
limit_memory_soft = 2013265920
limit_request = 8192
limit_time_cpu = 360
limit_real_time = 3600
limit_time_real_cron = 120
longpolling_port=8072
;logfile = /var/log/odoo/odoo-server.log
;logrotate = True
;log_level = debug
http_port =
;http_timeout = 1800
max_cron_threads = 2
workers = 5
websocket_keep_alive_timeout = 600
websocket_rate_limit_burst = 10
websocket_rate_limit_delay = 0.2
xmlrpc = True
xmlrpc_interface =
xmlrpc_port = 8069
xmlrpcs = True
xmlrpcs_interface =
xmlrpcs_port = 8071
proxy_mode = True
dbfilter = ^%h$

(Note: workers and max_cron_threads were also set, but their optimal values depend on server resources. We used workers = 3 and max_cron_threads = 1 from a working example, but later increased max_cron_threads to 2 for other reasons.)

  • Reult: Real-time chat (OdooBot/Discuss) is now working perfectly!

Final Caddyfile Snippet (Only tested with Odoo 17, 18 Instances)

# --- Odoo 18 Instances (Main Group) ---
your.domain.com, www.your.domain.com, other.domain.com { # Your list of domains
    encode zstd gzip

    reverse_proxy http://127.0.0.1:18069 { # Main Odoo port
        header_up X-Real-IP {http.request.header.Cf-Connecting-Ip}
        header_up X-Forwarded-For {http.request.header.Cf-Connecting-Ip}
        header_up Host {host}
        header_up X-Forwarded-Host {host}
        header_up X-Forwarded-Proto {scheme}
    }
    # Odoo WebSocket / Longpolling traffic
    reverse_proxy /websocket {
        to http://127.0.0.1:18072 # Longpolling port
        header_up Host {host}
        header_up X-Real-IP {http.request.header.Cf-Connecting-Ip}
        header_up X-Forwarded-For {http.request.header.Cf-Connecting-Ip}
        header_up X-Forwarded-Host {host}
        header_up X-Forwarded-Proto {scheme}
        header_up Upgrade {http.request.header.Upgrade}
        header_up Connection {http.request.header.Connection}
    }
}

This was a challenging but ultimately successful journey. I hope this detailed breakdown helps others facing similar complex Odoo 18 issues. We've created a full Blog Post about this experience with more details.
                 
 Epic Journey Through Real-time Chat & Cron Job

Best regards,

Ramon Rios Jr. 

Coqui Cloud

0
อวตาร
ละทิ้ง
Ray Carnes (ray)

Thanks for the update - where did you find a docker with limit_time_real_cron set to 2 seconds?

Ramon Rios
ผู้เขียน

I found it in another blog post and I assumed it was 2 for 2 mins, shortly after applying those settings I started receiving massive amounts of errors within seconds

สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
v16: Longpolling not working (not logging info in the IDE) แก้ไขแล้ว
server database postgresql longpoll longpolling
อวตาร
1
ธ.ค. 22
5329
User session continuously logs out
postgresql serialization concurrency workers longpolling
อวตาร
1
มี.ค. 22
4308
DB error when installing app.
database postgresql docker odoo11 Docker
อวตาร
0
พ.ย. 17
4482
Managing 2 companies with separate databases
database multidatabase
อวตาร
อวตาร
1
ก.ค. 25
1212
no real-time update in discuss แก้ไขแล้ว
realtime discuss
อวตาร
อวตาร
อวตาร
อวตาร
4
เม.ย. 25
6224
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ 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