Resolving 'Odoo Connection Lost, Trying to Reconnect' Issues

19 April 2024 by
Maz | ODIY Academy

In the intricate landscape of cloud-based enterprise resource planning (ERP) systems, seamless connectivity is a pillar of efficient operations. For Odoo users, encountering a "connection lost, trying to reconnect" error can be more than a minor inconvenience, albeit it should be super rare — it can disrupt critical business activities and impact productivity. This article delves into the core of these connection issues in Odoo (on-prem), offering a few tips on how to handle and prevent them through the strategic configuration of workers and the integration of Nginx as a reverse proxy.

Understanding the Roots of Connection Troubles in Odoo

Why does Odoo lose connection in the first place? 

The causes can be multifaceted, ranging from server overload and poor system configurations to more benign network hiccups. Whatever the cause, the result is the same: operations grind to a halt as the system struggles to regain its footing. This not only frustrates users but can also lead to data inconsistencies if not resolved swiftly.

The Role of Workers in Maintaining Connection Stability

Let's talk about workers. 

In Odoo, these aren't the human kind but processes that handle incoming web requests. By default, Odoo runs in a multi-threaded mode, which is fine for light loads but can falter as demand increases. Switching to a multi-processing mode with properly configured workers can offer a more robust solution. Here’s how you can optimise this setup:

  • Adjust the workers parameter in the odoo.conf file. Think of workers as your team members, where each member can handle only so many tasks before getting overwhelmed. Setting this parameter to about CPU cores * 2 + 1 usually strikes a nice balance.
  • Manage memory usage through the limit_memory_soft and limit_memory_hard settings, which control how much memory each worker can consume before Odoo decides it's time to recycle them.
  • Limit the requests a worker can handle (using limit_request) to ensure they are recycled before any potential memory leaks can impact performance.

screenshot  Resolving 'Odoo Connection Lost, Trying to Reconnect' Issues

Configuring workers correctly is like setting up a well-oiled machine—each part does its job efficiently, keeping the system stable and responsive.

Nginx: The Unsung Hero in Enhancing Connection Reliability

Introducing Nginx into your Odoo setup can be a game-changer. As a reverse proxy, it acts as a middleman between your users and Odoo, efficiently managing incoming traffic and distributing it to prevent overloads. It's like having a highly capable traffic officer who ensures that no single line gets too congested.

Setting up Nginx involves some technical steps, but the gist is that it handles all the HTTPS requests and forwards them to Odoo. This not only secures your data transmissions but also optimises connection handling. Plus, Nginx is known for its robustness in managing high numbers of simultaneous connections, making it an ideal choice for businesses expecting growth.

Let's Chat: Other Practical Tips for Connection Excellence

Here are a few more conversational nuggets of wisdom for keeping your Odoo connections smooth:

  • Stay updated: Always keep your Odoo and Nginx installations up-to-date. Developers are constantly releasing updates that enhance security and performance.
  • Keep an eye out: Regularly monitor your system’s performance. Catching issues early can prevent them from escalating into full-blown connection crises.
  • Lean on the community: The Odoo community is vibrant and resourceful. Engaging with forums and discussion groups can provide you with insights and solutions that are both innovative and practical.

You can access the Odoo documentation for on-premise deployment through this link: Odoo 17.0 on-premise deployment documentation. This resource covers essential topics such as system configuration and installation, providing all you need to effectively set up Odoo in your own infrastructure. 

For those seeking additional customisation or encountering specific challenges, it's advisable to refer to Odoo’s detailed configuration guidelines and engage with the community forums for personalised assistance.

Navigating the challenges of "Odoo connection lost, trying to reconnect" errors doesn't have to be a daunting task. With a thoughtful approach to configuring workers, leveraging the power of Nginx, and keeping engaged with the broader Odoo community, you can transform these frustrating interruptions into mere blips on your operational radar. 

Remember, every problem has a solution, and sometimes, it’s all about having the right tools and the knowledge to use them effectively.

Maz | ODIY Academy 19 April 2024
Share this post
Our blogs