Nova novncproxy doesnt work - unexpected keyword

Bug #1884580 reported by Michael Quiniola
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-eventlet (Ubuntu)
Fix Released
High
James Page
Focal
Fix Released
High
James Page
Groovy
Fix Released
High
James Page

Bug Description

== Impact ==

SSL secured console access to instances in OpenStack clouds is broken.

== Test Case ==

Deploy OpenStack using TLS secured endpoints (juju + charms)
Boot instance, attempt to access console via dashboard - error in web page and
error seen in nova-novncproxy log file.

== Regression Potential ==

Medium - the fix is in eventlet's use of the SSL native library which was broken when wrapping sockets using the SSLContext class. The fix has been
accepted upstream and is accompanied with a test case.

== Original Bug Report ==

Ubuntu Focal (20.04)
Openstack Ussuri (distro-proposed)
LXC
Nova Cloud Controller Charm Rev 68

When attempting to view the console in Horizon (Openstack Dashboard), console frame returns "503 Service Unavailable", when checking the nova cloud controller logs for nova-novncproxy, the following error appears:

2020-06-22 17:48:18.262 1463207 INFO nova.console.websocketproxy [-] handler exception: wrap_socket() got an unexpected keyword argument '_context'

Google seems to find related issues:
https://github.com/eventlet/eventlet/issues/526

as well as:

https://ask.openstack.org/en/question/127493/nova-novncproxy-fails-to-connect-handler-exception-wrap_socket-got-an-unexpected-keyword-argument-_context/

So it seems to be an issue with Python > 3.6, but I cannot downgrade python version as it would break nova-novncproxy (already tried)

description: updated
Revision history for this message
Michael Quiniola (qthepirate) wrote :

I just confirmed:

I reverted all nova-cloud-controller lxcs back to bionic (by deploying new LXC's with series set bionic) and using the source cloud:bionic-ussuri

Console WORKS on cloud:bionic-ussuri
Console BROKEN on focal distro-proposed

Revision history for this message
Ryan Beisner (1chb1n) wrote :

Is this also the case without distro-proposed (ie. Just focal)?

Revision history for this message
Michael Quiniola (qthepirate) wrote :

@1chb1n Charm will not install without specifying openstack-origin="distro-proposed" when installing on focal. just "distro" doesnt work, it will error.

Revision history for this message
Michael Quiniola (qthepirate) wrote :

Ryan,

My bad, i was wrong, it does deploy with "distro"

But it returns the same error in the novncproxy logs

James Page (james-page)
Changed in charm-nova-cloud-controller:
assignee: nobody → James Page (james-page)
Revision history for this message
James Page (james-page) wrote :

Full stacktrace:

2020-06-24 14:18:59.061 123476 DEBUG nova.console.websocketproxy [-] exception vmsg /usr/lib/python3/dist-packages/websockify/websockifyserver.py:634
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy Traceback (most recent call last):
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy File "/usr/lib/python3/dist-packages/websockify/websockifyserver.py", line 691, in top_new_client
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy client = self.do_handshake(startsock, address)
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy File "/usr/lib/python3/dist-packages/websockify/websockifyserver.py", line 585, in do_handshake
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy retsock = context.wrap_socket(
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy File "/usr/lib/python3/dist-packages/eventlet/green/ssl.py", line 438, in wrap_socket
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy return GreenSSLSocket(sock, *a, _context=self, **kw)
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy File "/usr/lib/python3/dist-packages/eventlet/green/ssl.py", line 67, in __new__
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy ret = _original_wrap_socket(
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy TypeError: wrap_socket() got an unexpected keyword argument '_context'
2020-06-24 14:18:59.061 123476 ERROR nova.console.websocketproxy

Revision history for this message
Michael Quiniola (qthepirate) wrote :

Honestly this is the only bug keeping me from doing full focal. Now that mysql-router is fixed i need to wait to upgrade NCC before the move to mysql-innodb

Revision history for this message
James Page (james-page) wrote :

Reproducer outside of websockify:

import eventlet
import ssl
import socket

eventlet.monkey_patch()

context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind((socket.gethostname(), 8080))
socket = context.wrap_socket(serversocket, server_side=True)

Revision history for this message
Michael Quiniola (qthepirate) wrote :

any ideas?

Revision history for this message
James Page (james-page) wrote :

I am working on it but eventlet's SSL monkey patching is somewhat non-trivial to follow.

Revision history for this message
Michael Quiniola (qthepirate) wrote :

Understood. Documentation is overrated, amirite?

Revision history for this message
James Page (james-page) wrote :

Its more that the SSL monkey patching that eventlet does has to be disable during certain parts of the socket wrapping process.

Following it is non trivial but I think I have something we can test out now.

Changed in charm-nova-cloud-controller:
status: New → In Progress
status: In Progress → Invalid
Changed in python-eventlet (Ubuntu Focal):
assignee: nobody → James Page (james-page)
Changed in python-eventlet (Ubuntu Groovy):
assignee: nobody → James Page (james-page)
Changed in python-eventlet (Ubuntu Focal):
status: New → In Progress
Changed in python-eventlet (Ubuntu Groovy):
status: New → In Progress
Changed in python-eventlet (Ubuntu Focal):
importance: Undecided → High
Changed in python-eventlet (Ubuntu Groovy):
importance: Undecided → High
Revision history for this message
James Page (james-page) wrote :

OK I think I have it figured out - python3-eventlet package building for focal here:

  https://launchpad.net/~james-page/+archive/ubuntu/ussuri

I'll submit the patch upstream as well for broader review.

Revision history for this message
James Page (james-page) wrote :
James Page (james-page)
description: updated
Revision history for this message
James Page (james-page) wrote :

PR accepted and landed upstream; I've uploaded to groovy and to focal for SRU team review.

The PPA has fixed versions for both series for those blocked by this issue.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-eventlet - 0.25.2-1ubuntu1

---------------
python-eventlet (0.25.2-1ubuntu1) groovy; urgency=medium

  * d/p/ssl-compat.patch: Fix compatibility with SSLContext base
    use of wrap_socket for Python >= 3.7 (LP: #1884580).

 -- James Page <email address hidden> Thu, 02 Jul 2020 07:59:52 +0100

Changed in python-eventlet (Ubuntu Groovy):
status: In Progress → Fix Released
Revision history for this message
Michael Quiniola (qthepirate) wrote :

Ok, it says fix released for groovy, is focal still affected until merge?

Revision history for this message
James Page (james-page) wrote :

@qthepirate - yes focal is still affected - I've uploaded the package for the stable release updates team to review.

Revision history for this message
Michael Quiniola (qthepirate) wrote :

Debating downloading your package upload to test it before they get to it just to see if it works. But its a production stack and I'm already having issues with other items

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Michael, or anyone else affected,

Accepted python-eventlet into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python-eventlet/0.25.1-2ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in python-eventlet (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Since this was accepted upstream I guess the change is safe, as (without context) I was originally a bit afraid that some other important parameters will be missed if we stop passing **kw. But I assume this just means there are no other arguments needed there besides the context field.

Revision history for this message
James Page (james-page) wrote :

Accepted upstream was my gate for starting the SRU process - it took me a while to figure out what actually needed to happen in the underlying code with regards to calling underlying un-monkey-patched code from the Python core ssl library. Passing the **kw arg its pretty pointless - the wrap_socket function does not have any other args than those called out specifically!

Revision history for this message
James Page (james-page) wrote :

Verified with focal-proposed packages - able to access novnc console for an instance running on a deployed OpenStack Cloud (see attachement)

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
James Page (james-page) wrote :
Revision history for this message
James Page (james-page) wrote :

$ apt-cache policy python3-eventlet
python3-eventlet:
  Installed: 0.25.1-2ubuntu1
  Candidate: 0.25.1-2ubuntu1
  Version table:
 *** 0.25.1-2ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     0.25.1-2build1 500
        500 http://nova.clouds.archive.ubuntu.com/ubuntu focal/main amd64 Packages

Revision history for this message
Michael Quiniola (qthepirate) wrote :

Beautiful! Will upgrade today for a double verification.

Revision history for this message
James Page (james-page) wrote :

@qthepirate be aware there are proposed updates for nova and neutron to resolve some other upgrade issues - nova around permissions (bug 1885269) and neutron around restarts of the cleanup systemd units for ovs and linuxbridge (bug 1885264).

Revision history for this message
James Page (james-page) wrote :

(you will definitely want the nova one).

Revision history for this message
Michael Quiniola (qthepirate) wrote :

@james-page

All other charms in my stack have been updated to focal-proposed (ussuri) and the last one I needed was nova-cloud-controller. Will run upgrades for updated packages though.

Revision history for this message
Michael Quiniola (qthepirate) wrote :

Confirmed fix! Deployed a new nova-cloud-controller unit, console now works.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-eventlet - 0.25.1-2ubuntu1

---------------
python-eventlet (0.25.1-2ubuntu1) focal; urgency=medium

  * d/p/ssl-compat.patch: Fix compatibility with SSLContext base
    use of wrap_socket for Python >= 3.7 (LP: #1884580).

 -- James Page <email address hidden> Thu, 02 Jul 2020 08:30:30 +0100

Changed in python-eventlet (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for python-eventlet has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Mathew Hodson (mhodson)
affects: charm-nova-cloud-controller → ubuntu-translations
no longer affects: ubuntu-translations
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.