aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/script
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-06-11 19:52:24 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-06-11 19:52:24 +1200
commit09edbd9492e59c0c8dcae69b4b1f4b745867abe4 (patch)
treee9cf29c394334c02d908058c2c5e159715d3e3c3 /mitmproxy/script
parent5b9f07c81c0dcc8c7b3d7afdeae8f6229ebf8622 (diff)
downloadmitmproxy-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/script')
-rw-r--r--mitmproxy/script/concurrent.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mitmproxy/script/concurrent.py b/mitmproxy/script/concurrent.py
index 89c835f6..56d39d0b 100644
--- a/mitmproxy/script/concurrent.py
+++ b/mitmproxy/script/concurrent.py
@@ -5,10 +5,10 @@ offload computations from mitmproxy's main master thread.
from __future__ import absolute_import, print_function, division
from mitmproxy import controller
-import threading
+from netlib import basethread
-class ScriptThread(threading.Thread):
+class ScriptThread(basethread.BaseThread):
name = "ScriptThread"
@@ -24,5 +24,8 @@ def concurrent(fn):
if not obj.reply.acked:
obj.reply.ack()
obj.reply.take()
- ScriptThread(target=run).start()
+ ScriptThread(
+ "script.concurrent (%s)" % fn.__name__,
+ target=run
+ ).start()
return _concurrent