Force reopening eventlet's hub after fork

With this we reopen eventlet's hub after a fork (triggered from
websockify when a new client connects) to prevent sharing epoll's fd
with the parent, which may cause erratic behaviour.

This caused novncproxy to stop working when it had more than two clients
connected.

Fixes bug #1193031

Change-Id: I3ff9001543b84b1037597da243422490bb611657
(cherry picked from commit cb25bc4530)
This commit is contained in:
Xavier Queralt 2013-07-17 01:31:36 +02:00 committed by Russell Bryant
parent 183d506262
commit 9315de02d6
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,11 @@ class NovaWebSocketProxy(websockify.WebSocketProxy):
"""
Called after a new WebSocket connection has been established.
"""
# Reopen the eventlet hub to make sure we don't share an epoll
# fd with parent and/or siblings, which would be bad
from eventlet import hubs
hubs.use_hub()
cookie = Cookie.SimpleCookie()
cookie.load(self.headers.getheader('cookie'))
token = cookie['token'].value