Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odoo service not working reliably in containers (SysVInit) #521

Closed
JedMeister opened this issue Dec 13, 2015 · 14 comments

Comments

Projects
None yet
3 participants
@JedMeister
Copy link
Member

commented Dec 13, 2015

A Odoo issue was reported in the forums and when I went to test it (in a container) I realised that the Odoo service wasn't working quite as it should in the container (containers use SysVInit rather than SystemD).

# cat /var/log/odoo/openerp-server-startup.log 
(Sun, 13 Dec 2015 22:10:57 +0000) - Script started with command: restart
(Sun, 13 Dec 2015 22:10:57 +0000) - script called - lock file created
(Sun, 13 Dec 2015 22:10:57 +0000) - created /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:10:57 +0000) - Restarting Odoo
(Sun, 13 Dec 2015 22:10:57 +0000) - Stopping Odoo
(Sun, 13 Dec 2015 22:10:57 +0000) - Odoo stopped
(Sun, 13 Dec 2015 22:10:58 +0000) - Starting Odoo
(Sun, 13 Dec 2015 22:10:59 +0000) - Odoo started!
(Sun, 13 Dec 2015 22:10:59 +0000) - script ending - lock file removed
(Sun, 13 Dec 2015 22:10:59 +0000) - removed /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:10:59 +0000) - script exit code: 0
(Sun, 13 Dec 2015 22:11:03 +0000) - Script started with command: restart
(Sun, 13 Dec 2015 22:11:03 +0000) - script called - lock file created
(Sun, 13 Dec 2015 22:11:03 +0000) - created /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:11:03 +0000) - Restarting Odoo
(Sun, 13 Dec 2015 22:11:03 +0000) - Stopping Odoo
(Sun, 13 Dec 2015 22:11:03 +0000) - Odoo stopped
(Sun, 13 Dec 2015 22:11:04 +0000) - Starting Odoo
(Sun, 13 Dec 2015 22:11:05 +0000) - Odoo started!
(Sun, 13 Dec 2015 22:11:05 +0000) - script ending - lock file removed
(Sun, 13 Dec 2015 22:11:05 +0000) - removed /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:11:05 +0000) - script exit code: 0
(Sun, 13 Dec 2015 22:15:02 +0000) - Script started with command: start
(Sun, 13 Dec 2015 22:15:02 +0000) - script called - lock file created
(Sun, 13 Dec 2015 22:15:02 +0000) - created /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:15:02 +0000) - Starting Odoo
(Sun, 13 Dec 2015 22:15:03 +0000) - Odoo started!
(Sun, 13 Dec 2015 22:15:03 +0000) - script ending - lock file removed
(Sun, 13 Dec 2015 22:15:03 +0000) - removed /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:15:03 +0000) - script exit code: 0
Exception in thread openerp.service.httpd:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/openerp/odoo/openerp/service/server.py", line 291, in http_thread
    self.httpd = ThreadedWSGIServerReloadable(self.interface, self.port, app)
  File "/opt/openerp/odoo/openerp/service/server.py", line 97, in __init__
    handler=RequestHandler)
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 410, in __init__
    HTTPServer.__init__(self, (host, int(port)), handler)
  File "/usr/lib/python2.7/SocketServer.py", line 420, in __init__
    self.server_bind()
  File "/opt/openerp/odoo/openerp/service/server.py", line 107, in server_bind
    super(ThreadedWSGIServerReloadable, self).server_bind()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 434, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use
# service openerp-server status
(Sun, 13 Dec 2015 22:53:25 +0000) - Script started with command: status
(Sun, 13 Dec 2015 22:53:25 +0000) - script called - lock file created
(Sun, 13 Dec 2015 22:53:25 +0000) - created /tmp/openerp-server.lock
Getting status of Odoo Server:
10660 ?        Sl     0:01 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
 4079 ?        Sl     0:01 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
(Sun, 13 Dec 2015 22:53:25 +0000) - script ending - lock file removed
(Sun, 13 Dec 2015 22:53:25 +0000) - removed /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:53:25 +0000) - script exit code: 0
# service openerp-server start
(Sun, 13 Dec 2015 22:53:53 +0000) - Script started with command: start
(Sun, 13 Dec 2015 22:53:53 +0000) - script called - lock file created
(Sun, 13 Dec 2015 22:53:53 +0000) - created /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:53:53 +0000) - Starting Odoo
(Sun, 13 Dec 2015 22:53:54 +0000) - Odoo started!
(Sun, 13 Dec 2015 22:53:54 +0000) - script ending - lock file removed
(Sun, 13 Dec 2015 22:53:54 +0000) - removed /tmp/openerp-server.lock
(Sun, 13 Dec 2015 22:53:54 +0000) - script exit code: 0

And it looks like there are some zombie processes running. I'm pretty sure that this is because SystemD is smarter than SysVInit and can deal witrh Zombie process...

# ps aux | grep python
openerp   4079  0.0  4.3 528248 91884 ?        Sl   22:11   0:05 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
openerp  10660  0.0  2.6 341440 56404 ?        Sl   22:31   0:01 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
openerp  12637  0.0  2.6 341436 56536 ?        Sl   22:53   0:01 python /opt/openerp/odoo/openerp-server --config=/etc/odoo/openerp-server.conf
root     12844  0.0  0.0  11124   944 pts/4    S+   22:57   0:00 grep --color=auto python

Once I killed the zombie processes and started Odoo all was well; although I imagine that if I tried to restart it we would have issues again...

@DocCyblade

This comment has been minimized.

Copy link
Member

commented Dec 14, 2015

Well this is not good news! However I do have good news I do have a Proxmox box and can test this :-) I also will have some time to test it as well!

I'll look at the form post see what's what in s few days.

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Dec 14, 2015

@DocCyblade the issue on the forums is unrelated. I just discovered this when trying to test the other issue (which I haven't been able to reproduce yet).

It's handy that you now have Proxmox! It should be easy to test (and fix).

Even when you provide a SysVInit style /etc/init.d/ script SystemD intercepts the script (rather than just running it; as it does with SysVInit). FWIW Liraz wrote a blog post about his experiences with SystemD SysVInit compatibility mode troubleshooting which might be useful on understanding what it's doing in the background.

If you can get the /etc/init.d/ file to work reliably in LXC; then it should work fine in SystemD. Like I said above, SystemD is much smarter than SysVInit.

PS hope you don't mind assigning you! 😄

@l-arnold

This comment has been minimized.

Copy link

commented Dec 16, 2015

I've been using XEN builds. (Not really a a container). Will test some process start stop there on Linode. Would like to do a Docker Test but need to build a Docker Host first.

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Dec 16, 2015

Whilst the docker builds are a container; they use SystemD (same as ISO, OVA, Xen, etc). The other container builds (i.e. for Proxmox, OpenNode and LXC/OpenVZ) use SysVInit instead. So checking in docker still won't be a reliable test...

@l-arnold

This comment has been minimized.

Copy link

commented Dec 16, 2015

Interested in how to run the second set but do not have any platform right now.

Did bounce into digitalocean.com but did not test. Seems would be a way to run some how.

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Dec 16, 2015

I think Digital Ocean support installing from ISO but I'm not sure...

Once we have the LXC appliance finished then you could run that as a guest in VMware and run TurnKey LXC containers inside! 😄

@DocCyblade

This comment has been minimized.

Copy link
Member

commented Dec 16, 2015

Jeremy I'll be testing this in the next few days as I am off of work. Il have to rebuild my Proxmox box as its broken currently

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2015

Cool, thanks Ken. I'm by no means an expert; but if you need a hand with Proxmox feel free to shoot me an email! 😄
TBH I'm actually more concerned about #522 (as it affects all builds) although fixing this first is probably a wise approach as it may actually resolve that one anyway...

@DocCyblade

This comment has been minimized.

Copy link
Member

commented Dec 17, 2015

@JedMeister give me shout via email about Proxmox. I'd like to know how or the best way to set it up for testing TKL. The PC I have for this is a quad core I7 with 16 gigs of RAM and three 120GB SATA SSD drives and esata raid 5 with 5 120GB SSD. Best way to use these drives?

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2015

WIll do! 😄

@DocCyblade

This comment has been minimized.

Copy link
Member

commented Jan 14, 2016

Checking in quick. Work has taken a lot of my time. I am waiting on some parts for my Proxmox setup so I don't have a Proxmox setup yet. Should be next week.

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Jan 14, 2016

No worries Ken. Thanks for the update! 😄

@l-arnold

This comment has been minimized.

Copy link

commented Jan 17, 2016

I am using XEN on Linode. Is that a container. Somewhat a Hack to get it to work but it works pretty easily being a hack.

@JedMeister

This comment has been minimized.

Copy link
Member Author

commented Jan 17, 2016

No, Xen is similar type virtualisation to VMware, VirtualBox or KVM. Amazon use Xen too; although apparently their's is a little customised

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.