diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-06-11 19:52:24 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-06-11 19:52:24 +1200 |
commit | 09edbd9492e59c0c8dcae69b4b1f4b745867abe4 (patch) | |
tree | e9cf29c394334c02d908058c2c5e159715d3e3c3 /mitmproxy/controller.py | |
parent | 5b9f07c81c0dcc8c7b3d7afdeae8f6229ebf8622 (diff) | |
download | mitmproxy-09edbd9492e59c0c8dcae69b4b1f4b745867abe4.tar.gz mitmproxy-09edbd9492e59c0c8dcae69b4b1f4b745867abe4.tar.bz2 mitmproxy-09edbd9492e59c0c8dcae69b4b1f4b745867abe4.zip |
Improve debugging of thread and other leaks
- Add basethread.BaseThread that all threads outside of test suites should use
- Add a signal handler to mitmproxy, mitmdump and mitmweb that dumps resource
information to screen when SIGUSR1 is received.
- Improve thread naming throughout to make thread dumps understandable
Diffstat (limited to 'mitmproxy/controller.py')
-rw-r--r-- | mitmproxy/controller.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py index 084702a6..898be3bc 100644 --- a/mitmproxy/controller.py +++ b/mitmproxy/controller.py @@ -5,8 +5,10 @@ import threading from six.moves import queue +from netlib import basethread from mitmproxy import exceptions + Events = frozenset([ "clientconnect", "clientdisconnect", @@ -95,12 +97,13 @@ class Master(object): self.should_exit.set() -class ServerThread(threading.Thread): +class ServerThread(basethread.BaseThread): def __init__(self, server): self.server = server - super(ServerThread, self).__init__() address = getattr(self.server, "address", None) - self.name = "ServerThread ({})".format(repr(address)) + super(ServerThread, self).__init__( + "ServerThread ({})".format(repr(address)) + ) def run(self): self.server.serve_forever() |