Merge lp:~andreserl/maas/fix_lp1441399 into lp:~maas-committers/maas/trunk

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 3797
Proposed branch: lp:~andreserl/maas/fix_lp1441399
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 72 lines (+29/-3)
2 files modified
src/maasserver/eventloop.py (+16/-2)
src/provisioningserver/plugin.py (+13/-1)
To merge this branch: bzr merge lp:~andreserl/maas/fix_lp1441399
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Mike Pontillo (community) Approve
Review via email: mp+255453@code.launchpad.net

Commit message

Fix #1441399: socket.error: [Errno 92] Protocol not available. Python's so cket module was compiled using modern headers thus defining SO_REUSEPORT would cause issues as it might running in older kernel that does not support SO_REUSEPORT.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Since you've already tested this and the window for failure is small, I would go ahead and approve this. But please consider catching a narrower set of exceptions. (see comment below)

You might also want to consider logging a warning when this happens, to encourage the user to upgrade to a *real* version of Trusty. ;-)

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

Looks generally good but:
- I agree with Mike about catching just the exception we need to catch.
- This needs a test.
- This MP needs a better commit message.

review: Needs Fixing
Revision history for this message
Raphaël Badin (rvb) wrote :

Approving this not to block you. As discussed, please only swallow that particular exception that we want to skip… if you don't have time for the tests, please file a tech-debt bug a put a reference to it there.

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Replied comment inline

Revision history for this message
Raphaël Badin (rvb) wrote :

replied inline

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (82.8 KiB)

The attempt to merge lp:~andreserl/maas/fix_lp1441399 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [76.4 kB]
Get:6 http://security.ubuntu.com trusty-security/universe Sources [19.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [253 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [190 kB]
Get:9 http://security.ubuntu.com trusty-security/universe amd64 Packages [92.0 kB]
Get:10 http://security.ubuntu.com trusty-security/main Translation-en [127 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [108 kB]
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [491 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [263 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,750 kB in 3s (534 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-iscpy python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-no...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (82.8 KiB)

The attempt to merge lp:~andreserl/maas/fix_lp1441399 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [76.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [19.5 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [253 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [92.0 kB]
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [190 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [108 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [493 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [263 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en [233 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,858 kB in 3s (560 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-iscpy python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-no...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (85.4 KiB)

The attempt to merge lp:~andreserl/maas/fix_lp1441399 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [76.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [19.5 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [253 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [92.0 kB]
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [190 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [108 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [493 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [263 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,625 kB in 3s (533 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-iscpy python-jinja2 python-jsonschema python-lockfile python-lxml python-mock python-netaddr python-netifaces python-nose python-oa...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/eventloop.py'
2--- src/maasserver/eventloop.py 2015-02-18 00:02:06 +0000
3+++ src/maasserver/eventloop.py 2015-04-08 16:24:36 +0000
4@@ -50,10 +50,14 @@
5 "stop",
6 ]
7
8+from errno import ENOPROTOOPT
9 from logging import getLogger
10 from os import getpid
11 import socket
12-from socket import gethostname
13+from socket import (
14+ error as socket_error,
15+ gethostname,
16+)
17
18 from django.db import connections
19 from provisioningserver.utils.twisted import asynchronous
20@@ -155,7 +159,17 @@
21 # not yet official support for setting socket options.
22 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
23 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
24- s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
25+ try:
26+ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
27+ except socket_error as e:
28+ # Python's socket module was compiled using modern headers
29+ # thus defining SO_REUSEPORT would cause issues as it might
30+ # running in older kernel that does not support SO_REUSEPORT.
31+
32+ # XXX andreserl 2015-04-08 bug=1441684: We need to add a warning
33+ # log message when we see this error, and a test for it.
34+ if e.errno != ENOPROTOOPT:
35+ raise e
36 s.bind(('0.0.0.0', site_port))
37 # Use a backlog of 50, which seems to be fairly common.
38 s.listen(50)
39
40=== modified file 'src/provisioningserver/plugin.py'
41--- src/provisioningserver/plugin.py 2015-03-25 15:33:23 +0000
42+++ src/provisioningserver/plugin.py 2015-04-08 16:24:36 +0000
43@@ -16,8 +16,10 @@
44 "ProvisioningServiceMaker",
45 ]
46
47+from errno import ENOPROTOOPT
48 import os
49 import socket
50+from socket import error as socket_error
51
52 from twisted.application.internet import TCPServer
53 from twisted.application.service import IServiceMaker
54@@ -119,7 +121,17 @@
55 # not yet official support for setting socket options.
56 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
57 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
58- s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
59+ try:
60+ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
61+ except socket_error as e:
62+ # Python's socket module was compiled using modern headers
63+ # thus defining SO_REUSEPORT would cause issues as it might
64+ # running in older kernel that does not support SO_REUSEPORT.
65+
66+ # XXX andreserl 2015-04-08 bug=1441684: We need to add a warning
67+ # log message when we see this error, and a test for it.
68+ if e.errno != ENOPROTOOPT:
69+ raise e
70 s.bind(('0.0.0.0', port))
71 # Use a backlog of 50, which seems to be fairly common.
72 s.listen(50)