B.Pradip
B.Pradip

Reputation: 13

Odoo server too slow to shutdown

I am running Odoo 8 with Python 2.7 on a laptop (i5, 8Gb RAM, SSD, Win 10) Every time I need to shutdown the server to update my code (using ctrl + C twice), it takes almost 2 mins before it shuts down.

Is there any way to make the shutdown faster ??

Terminal Output when Shutting down

2017-01-17 09:58:54,161 7256 INFO ? openerp.service.server: Initiating shutdown

2017-01-17 09:58:54,167 7256 INFO ? openerp.service.server: Hit CTRL-C again or send a second signal to force the shutdown.

Traceback (most recent call last):
  File "odoo.py", line 160, in <module>
    main()

  File "odoo.py", line 157, in main
    openerp.cli.main()

  File "C:\odoo-8.0\openerp\cli\__init__.py", line 68, in main
    o.run(args)

  File "C:\odoo-8.0\openerp\cli\server.py", line 180, in run
    main(args)

  File "C:\odoo-8.0\openerp\cli\server.py", line 174, in main
    rc = openerp.service.server.start(preload=preload, stop=stop)

  File "C:\odoo-8.0\openerp\service\server.py", line 970, in start
    rc = server.run(preload, stop)

  File "C:\odoo-8.0\openerp\service\server.py", line 374, in run
    self.stop()

  File "C:\odoo-8.0\openerp\service\server.py", line 330, in stop
    self.httpd.shutdown()

  File "C:\Python27\lib\SocketServer.py", line 246, in shutdown
    self.__is_shut_down.wait()

  File "C:\Python27\lib\threading.py", line 614, in wait
    self.__cond.wait(timeout)

  File "C:\Python27\lib\threading.py", line 340, in wait
    waiter.acquire()

KeyboardInterrupt

Upvotes: 1

Views: 2007

Answers (2)

Federico Ba&#249;
Federico Ba&#249;

Reputation: 7715

This happens with Odoo, when shutting down the server in some instances may take some seconds up to 2 -3 minutes.

Is quite annoying, especially when you need to make small changes.

Quick Solution

Just open 2 (or more, but it shouldn't be needed) Terminal windows.

So when you Kill the first window, while is taking is time to shut down, you can use the other Terminal to Run a new instance of the server.

Doing this, avoids any waiting, no need to re-write / re-structure or anything.

Upvotes: 0

Steve Barnes
Steve Barnes

Reputation: 28405

The server wait on shutdown is to ensure that all records are saved, etc., as part of the clean shutdown. There are 2 strategies you could consider to alleviate the pain:

  1. Restructure your software so that the server only needs to be shutdown when there are changes to the server software - i.e. Run the server from one, small well tested, process and connect to that process from the rest of your code - provided the server interface does not need updating, hence the well tested, there is no need to shutdown that portion of the code so you simply disconnect rather than shutting down.

  2. Write a small, well tested, load and execute top level program and provide a mechanism for telling it to reload the changed code, also known as a dynamic plug-in architecture. This is a lot more complex as code that has been running may leave behind artefacts, etc.

Upvotes: 1

Related Questions