Auto merge of #21741 - Eijebong:deadlocks-should-stay-dead, r=jdm

Try to unlock the global lock in StructuredLogger after reloading log…

…ging

This should finally fix all the websockets related failures we've been
seeing lately.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21741)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-09-18 17:28:20 -04:00 committed by GitHub
commit 97dc06c305
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -650026,7 +650026,7 @@
"support" "support"
], ],
"tools/serve/serve.py": [ "tools/serve/serve.py": [
"31a08dbd016752db5925410dbf5435a0e8623981", "104701caf85ba2250d4c844650025517f0d473b6",
"support" "support"
], ],
"tools/serve/test_functional.py": [ "tools/serve/test_functional.py": [

View file

@ -19,8 +19,10 @@ from collections import defaultdict, OrderedDict
from multiprocessing import Process, Event from multiprocessing import Process, Event
from localpaths import repo_root from localpaths import repo_root
from six.moves import reload_module
from manifest.sourcefile import read_script_metadata, js_meta_re, parse_variants from manifest.sourcefile import read_script_metadata, js_meta_re, parse_variants
from mozlog.structuredlog import StructuredLogger
from wptserve import server as wptserve, handlers from wptserve import server as wptserve, handlers
from wptserve import stash from wptserve import stash
from wptserve import config from wptserve import config
@ -631,9 +633,10 @@ class WebSocketDaemon(object):
def start_ws_server(host, port, paths, routes, bind_address, config, **kwargs): def start_ws_server(host, port, paths, routes, bind_address, config, **kwargs):
# Ensure that when we start this in a new process we have the global lock # Ensure that when we start this in a new process we have the global lock
# in the logging module unlocked # in the logging module unlocked
reload_module(logging)
try: try:
logging._releaseLock() StructuredLogger._lock.release()
except RuntimeError: except threading.ThreadError:
pass pass
return WebSocketDaemon(host, return WebSocketDaemon(host,
str(port), str(port),
@ -647,9 +650,10 @@ def start_ws_server(host, port, paths, routes, bind_address, config, **kwargs):
def start_wss_server(host, port, paths, routes, bind_address, config, **kwargs): def start_wss_server(host, port, paths, routes, bind_address, config, **kwargs):
# Ensure that when we start this in a new process we have the global lock # Ensure that when we start this in a new process we have the global lock
# in the logging module unlocked # in the logging module unlocked
reload_module(logging)
try: try:
logging._releaseLock() StructuredLogger._lock.release()
except RuntimeError: except threading.ThreadError:
pass pass
return WebSocketDaemon(host, return WebSocketDaemon(host,
str(port), str(port),