There are times, when you might suddenly see your Odoo is shutdown automatically, without warning. Once you enable to logging, you could see an error like the following:
virtual real time limit (151/120s) reached.
or in full details like the following
2021-04-22 06:46:44,054 32685 WARNING ? odoo.service.server: Thread <Thread(odoo.service.http.request.140015617943296, started 140015617943296)> virtual real time limit (151/120s) reached. 2021-04-22 06:46:44,054 32685 INFO ? odoo.service.server: Dumping stacktrace of limit exceeding threads before reloading 2021-04-22 06:46:44,060 32685 INFO ? odoo.tools.misc: # Thread: <Thread(odoo.service.http.request.140015617943296, started 140015617943296)> (db:n/a) (uid:n/a) (url:n/a) File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/threading.py", line 884, in _bootstrap self._bootstrap_inner() File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/socketserver.py", line 654, in process_request_thread self.finish_request(request, client_address) File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/socketserver.py", line 364, in finish_request self.RequestHandlerClass(request, client_address, self) File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/socketserver.py", line 724, in __init__ self.handle() File: "/opt/odoo/odoo14-venv/lib64/python3.6/site-packages/werkzeug/serving.py", line 329, in handle rv = BaseHTTPRequestHandler.handle(self) File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/http/server.py", line 418, in handle self.handle_one_request() File: "/opt/odoo/odoo14-venv/lib64/python3.6/site-packages/werkzeug/serving.py", line 360, in handle_one_request self.raw_requestline = self.rfile.readline() File: "/opt/rh/rh-python36/root/usr/lib64/python3.6/socket.py", line 586, in readinto return self._sock.recv_into(b) 2021-04-22 06:46:44,060 32685 INFO ? odoo.service.server: Initiating server reload
This is because Odoo is killing zombie processes and probably mistakenly crashing your Odoo completely while doing so. The parameter that is used for this purpose, can be found in Odoo documentation:
https://www.odoo.com/documentation/14.0/reference/cmdline.html
--limit-time-real <limit> Prevents the worker from taking longer than <limit> seconds to process a request. If the limit is exceeded, the worker is killed. Differs from --limit-time-cpu in that this is a “wall time” limit including e.g. SQL queries. Defaults to 120.
You may start your service command with something like –limit-time-real 100000 to avoid Odoo from auto killing processes. A command could look like the following if you edit your service file located at:
/etc/systemd/system/odoo14.service
The exec would be like the following:
ExecStart=/usr/bin/scl enable rh-python36 -- /opt/odoo/odoo14-venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo.conf --limit-time-real=100000
Once the change is done, save the file, and reload the system daemon and restart your Odoo
systemctl daemon-reload service odoo14 restart
Really helped a lot, after about 4 days of going round and round. Thanks!