Merge pull request #240 from korniltsev/thread_leak

kill analysis thread on deletefork
This commit is contained in:
George Hotz 2020-03-22 22:58:14 -07:00 committed by GitHub
commit 841197e3cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -417,6 +417,7 @@ class Trace:
self.strace = []
self.mapped = []
self.keep_analysis_thread = True
threading.Thread(target=self.analysis_thread).start()
def fetch_raw_memory(self, clnum, address, ln):
@ -502,8 +503,8 @@ class Trace:
self.strace = ret
def analysis_thread(self):
#print "*** started analysis_thread"
while 1:
print("*** started analysis_thread", self.forknum)
while self.keep_analysis_thread:
time.sleep(0.2)
# so this is done poorly, analysis can be incremental
if self.maxclnum == None or self.db.get_maxclnum() != self.maxclnum:
@ -527,6 +528,7 @@ class Trace:
self.needs_update = True
#print "analysis is ready"
print("*** ended analysis_thread", self.forknum)
def load_base_memory(self):
def get_forkbase_from_log(n):

View File

@ -146,7 +146,9 @@ def deletefork(forknum):
global program
print("deletefork", forknum)
os.unlink(qira_config.TRACE_FILE_BASE+str(int(forknum)))
del program.traces[forknum]
if forknum in program.traces:
program.traces[forknum].keep_analysis_thread = False
del program.traces[forknum]
push_updates()
@socketio.on('doslice', namespace='/qira')