我正在为一个托管SWIGged(非常)大型C ++扩展模块的遗留Python应用程序中重新安装正常关闭的过程。我在翻译关闭期间遇到了崩溃,我没有想法,所以我希望你能帮我解决原因。
以上是我目前收集的信息:
ntdll.dll!TpCallbackIndependent+0x238
; ntdll.dll!RtlMoveMemory+x5a5
; ntdll.dll
中的线程仍在运行,退出状态为1; 此TpCallbackIndependent
似乎与Windows Thread Pool API相关,此应用程序使用 。我可以列出所有外部Python库,如果它对你来说意味着什么,但我不认为它们中的任何一个都使用它。
编辑:可能的罪魁祸首是pycurl
模块。我发出第一个pycurl.Curl.perform()
后,RtlMoveMemory
和mswsock
个主题就会启动。即使我调用pycurl.global_cleanup()
(此时mswsock
线程消失,RtlMoveMemory
线程也永远不会完成,TpCallbackIndependent
虚假地出现并在此之后永远消失。
pycurl.version
打印" libcurl / 7.20.1 OpenSSL / 0.9.8q zlib / 1.2.5"我不知道pycurl
版本是什么(我只有.pyd
文件。)
编辑:这是一个示例Pycurl程序,可以创建有问题的线程。出于某种原因,我无法解释,这个特殊的调用并没有崩溃......
import cStringIO
import pycurl
import sys
pycurl.global_init(pycurl.GLOBAL_DEFAULT)
try:
b = cStringIO.StringIO()
# Issue request.
c = pycurl.Curl()
try:
c.setopt(pycurl.CUSTOMREQUEST, 'GET')
c.setopt(c.URL, 'http://www.google.ca')
c.setopt(c.WRITEFUNCTION, b.write)
print 'Type anything to issue the request.'
sys.stdin.readline()
c.perform()
# Threads appear as a result of the `.perform()`
# operation. If you monitor the active threads
# in "process explorer", you see that the threads
# appear here.
finally:
c.close()
del c
finally:
print 'Type anything to cleanup.'
sys.stdin.readline()
pycurl.global_cleanup()
# If you're still looking at active threads in "process
# explorer", you see that some threads (the mswsock.dll
# thread in particular) have disappeared, but there are still
# weird TpCallbackIndependent threads showing up.
print 'Type anything to exit.'
sys.stdin.readline()
答案 0 :(得分:0)
在调用清理之前,请确保关闭所有pycurl对象。这包括简单,共享和多个对象。