Include Thread status when printing leaked threads
MSP-11147 Sometime travis-ci is showing leaked threads even when 'Msf::Framework#threads cleaner' is being used, so I'm adding the `Thread#status` to the data printed about the Thread to see if the sometimes leaked threads have an odd status. There's still a chance that there will be a race-condition between when I call Thread.list and I ask for each Thread's status that the VM could finish aborting a Thread so that status I print isn't the same as the one that caused the Thread to be returned in Thread.list.bug/bundler_fix
parent
ba836f2383
commit
e3869ee1ae
|
@ -77,14 +77,18 @@ module Metasploit
|
||||||
if LOG_PATHNAME.exist?
|
if LOG_PATHNAME.exist?
|
||||||
caller_by_thread_uuid = Metasploit::Framework::Spec::Threads::Suite.caller_by_thread_uuid
|
caller_by_thread_uuid = Metasploit::Framework::Spec::Threads::Suite.caller_by_thread_uuid
|
||||||
|
|
||||||
thread_uuids = thread_list.map { |thread|
|
thread_list.each do |thread|
|
||||||
thread[Metasploit::Framework::Spec::Threads::Suite::UUID_THREAD_LOCAL_VARIABLE]
|
thread_uuid = thread[Metasploit::Framework::Spec::Threads::Suite::UUID_THREAD_LOCAL_VARIABLE]
|
||||||
}.compact
|
|
||||||
|
# unmanaged thread, such as the main VM thread
|
||||||
|
unless thread_uuid
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
thread_uuids.each do |thread_uuid|
|
|
||||||
caller = caller_by_thread_uuid[thread_uuid]
|
caller = caller_by_thread_uuid[thread_uuid]
|
||||||
|
|
||||||
error_lines << "Thread #{thread_uuid}\n"
|
error_lines << "Thread #{thread_uuid}'s status is #{thread.status.inspect} " \
|
||||||
|
"and was started here:\n"
|
||||||
|
|
||||||
error_lines.concat(caller)
|
error_lines.concat(caller)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue