进程已完成,退出代码为 -1073741819 (0xC0000005)(Cython、TeamSpeak3)
Process finished with exit code -1073741819 (0xC0000005) (Cython, TeamSpeak3)
我现在的目标是创建 team speak 3 经理服务(通过频道切换用户):
所以我创建了 TS3 SDK lib 的包装器(用 Cython 包装 Python):https://mega.nz/#!pQdFjIwD!1vg8DPsFtYR4icVqWXzvpdbAQ47-n-aPz2niRkTU4fY (main module: http://pastebin.com/PywhH4bf)
在这个包装器中,我在模块中使用了测试连接。要测试这个模块,只需导入这个。
我在 python 控制台中收到消息(在调用 ts3client_startConnection
之后):Process finished with exit code -1073741819 (0xC0000005)
(访问冲突)
而且我看到 TS3 回调是从非主线程调用的。
有了这个日志:
2016-08-16 10:14:20.862577|INFO | | |TeamSpeak 3 Client 3.0.3 (2015-03-30 11:30:36) SDK
2016-08-16 10:14:20.863574|INFO | | |SystemInformation: Windows 9 8664 {6} {3} {9600} (9600) x64 (AMD or Intel) Binary: 32bit
2016-08-16 10:14:20.863574|INFO | | |Using hardware aes
2016-08-16 10:14:20.876587|DEBUG |Direct Sound | |setting timer resolution to 1ms
2016-08-16 10:14:20.892602|ERROR |SoundBckndIntf| |Could not load "ts3soundbackend_isSupported" from backend dynamic library
spawn connection handler
mode
Default capture mode: b'Windows Audio Session'
('Default capture device: %s %s\n', b'\xd0\x9c\xd0\xb8\xd0\xba\xd1\x80\xd0\xbe\xd1\x84\xd0\xbe\xd0\xbd (\xd0\xa3\xd1\x81\xd1\x82\xd1\x80\xd0\xbe\xd0\xb9\xd1\x81\xd1\x82\xd0\xb2\xd0\xbe \xd1\x81 \xd0\xbf\xd0\xbe\xd0\xb4\xd0\xb4\xd0\xb5\xd1\x80\xd0\xb6\xd0\xba\xd0\xbe\xd0\xb9 High Definition Audio)', b'{0.0.1.00000000}.{c28d826f-9cd5-414b-a018-bbfc0cbc1298}')
2016-08-16 10:14:20.905616|DEBUG |Windows Audio Session| |WAS::openDevice-enter
2016-08-16 10:14:20.912622|DEBUG |Windows Audio Session| |WAS Buffer size: 896
2016-08-16 10:14:20.912622|DEBUG |Windows Audio Session| |WAS::openDevice-leave
2016-08-16 10:14:20.912622|INFO |PreProSpeex |1 |Speex version: speex-1.2beta3
2016-08-16 10:14:20.912622|DEBUG |Windows Audio Session| |WAS::startDevice-enter
2016-08-16 10:14:20.913622|DEBUG |Windows Audio Session| |WAS::startDevice-leave
Default playback mode: b'Windows Audio Session'
('Default playback device: %s %s\n', b'\xd0\x94\xd0\xb8\xd0\xbd\xd0\xb0\xd0\xbc\xd0\xb8\xd0\xba\xd0\xb8 (\xd0\xa3\xd1\x81\xd1\x82\xd1\x80\xd0\xbe\xd0\xb9\xd1\x81\xd1\x82\xd0\xb2\xd0\xbe \xd1\x81 \xd0\xbf\xd0\xbe\xd0\xb4\xd0\xb4\xd0\xb5\xd1\x80\xd0\xb6\xd0\xba\xd0\xbe\xd0\xb9 High Definition Audio)', b'{0.0.0.00000000}.{cb324415-bf79-473b-9a59-69a1ca4bfe56}')
2016-08-16 10:14:20.913622|DEBUG |Windows Audio Session| |WAS::openDevice-enter
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS Buffer size: 896
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS::openDevice-leave
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS::startDevice-enter
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS::startDevice-leave
creating identity
Using identity: b'295V/MObSjZ2wIe+dMWhUoLET/UpS6ENHlhWSVdYYSZ5UnQTU3dneUFQLAF/FDVRBXkaFVFeAH10V1cDQn0Gd3BVYgFgXwV4IgxjOVB2DCwtET9TfgcaA31GE1MBZFxLBXtgDHd9WHFka0NJUUQweGprQnp2cjNrSkxBMXJaazRWeDJMTkRUOUlXcVVyZ0p0WnpDU0lDOVlRPT0='
Client lib initialized and running
Connect status changed: 1 1 0
2016-08-16 10:14:20.926635|DEVELOP |PktHandler | |Puzzle solve time: 7
Connect status changed: 1 2 0
Connect status changed: 1 3 0
Connect status changed: 1 4 0
我也遇到了不可重复的随机错误:
Fatal Python error: GC object already tracked
和
Fatal Python error: PyThreadState_Get: no current thread
由于没有可验证的例子,所以有点猜测。
如果从 C 库 (ts3client_*) 创建的线程调用这些处理程序函数,则在调用 python 函数时尚未正确获取 GIL。
加with gil
赞
cdef void onConnectStatusChangeEvent(uint64 serverConnectionHandlerID,
int newStatus,
unsigned int errorNumber) with gil:
可能会有帮助。
__main__()
末尾也没有代码,最好是主线程至少是空闲的
if (error != ERROR_ok):
print("Error connecting to server: %d\n"% error)
print("Client lib initialized and running\n")
可以在打印调用之后添加以下行以进行快速测试
import time
while True:
time.sleep(1.0)
我现在的目标是创建 team speak 3 经理服务(通过频道切换用户): 所以我创建了 TS3 SDK lib 的包装器(用 Cython 包装 Python):https://mega.nz/#!pQdFjIwD!1vg8DPsFtYR4icVqWXzvpdbAQ47-n-aPz2niRkTU4fY (main module: http://pastebin.com/PywhH4bf) 在这个包装器中,我在模块中使用了测试连接。要测试这个模块,只需导入这个。
我在 python 控制台中收到消息(在调用 ts3client_startConnection
之后):Process finished with exit code -1073741819 (0xC0000005)
(访问冲突)
而且我看到 TS3 回调是从非主线程调用的。
有了这个日志:
2016-08-16 10:14:20.862577|INFO | | |TeamSpeak 3 Client 3.0.3 (2015-03-30 11:30:36) SDK
2016-08-16 10:14:20.863574|INFO | | |SystemInformation: Windows 9 8664 {6} {3} {9600} (9600) x64 (AMD or Intel) Binary: 32bit
2016-08-16 10:14:20.863574|INFO | | |Using hardware aes
2016-08-16 10:14:20.876587|DEBUG |Direct Sound | |setting timer resolution to 1ms
2016-08-16 10:14:20.892602|ERROR |SoundBckndIntf| |Could not load "ts3soundbackend_isSupported" from backend dynamic library
spawn connection handler
mode
Default capture mode: b'Windows Audio Session'
('Default capture device: %s %s\n', b'\xd0\x9c\xd0\xb8\xd0\xba\xd1\x80\xd0\xbe\xd1\x84\xd0\xbe\xd0\xbd (\xd0\xa3\xd1\x81\xd1\x82\xd1\x80\xd0\xbe\xd0\xb9\xd1\x81\xd1\x82\xd0\xb2\xd0\xbe \xd1\x81 \xd0\xbf\xd0\xbe\xd0\xb4\xd0\xb4\xd0\xb5\xd1\x80\xd0\xb6\xd0\xba\xd0\xbe\xd0\xb9 High Definition Audio)', b'{0.0.1.00000000}.{c28d826f-9cd5-414b-a018-bbfc0cbc1298}')
2016-08-16 10:14:20.905616|DEBUG |Windows Audio Session| |WAS::openDevice-enter
2016-08-16 10:14:20.912622|DEBUG |Windows Audio Session| |WAS Buffer size: 896
2016-08-16 10:14:20.912622|DEBUG |Windows Audio Session| |WAS::openDevice-leave
2016-08-16 10:14:20.912622|INFO |PreProSpeex |1 |Speex version: speex-1.2beta3
2016-08-16 10:14:20.912622|DEBUG |Windows Audio Session| |WAS::startDevice-enter
2016-08-16 10:14:20.913622|DEBUG |Windows Audio Session| |WAS::startDevice-leave
Default playback mode: b'Windows Audio Session'
('Default playback device: %s %s\n', b'\xd0\x94\xd0\xb8\xd0\xbd\xd0\xb0\xd0\xbc\xd0\xb8\xd0\xba\xd0\xb8 (\xd0\xa3\xd1\x81\xd1\x82\xd1\x80\xd0\xbe\xd0\xb9\xd1\x81\xd1\x82\xd0\xb2\xd0\xbe \xd1\x81 \xd0\xbf\xd0\xbe\xd0\xb4\xd0\xb4\xd0\xb5\xd1\x80\xd0\xb6\xd0\xba\xd0\xbe\xd0\xb9 High Definition Audio)', b'{0.0.0.00000000}.{cb324415-bf79-473b-9a59-69a1ca4bfe56}')
2016-08-16 10:14:20.913622|DEBUG |Windows Audio Session| |WAS::openDevice-enter
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS Buffer size: 896
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS::openDevice-leave
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS::startDevice-enter
2016-08-16 10:14:20.918627|DEBUG |Windows Audio Session| |WAS::startDevice-leave
creating identity
Using identity: b'295V/MObSjZ2wIe+dMWhUoLET/UpS6ENHlhWSVdYYSZ5UnQTU3dneUFQLAF/FDVRBXkaFVFeAH10V1cDQn0Gd3BVYgFgXwV4IgxjOVB2DCwtET9TfgcaA31GE1MBZFxLBXtgDHd9WHFka0NJUUQweGprQnp2cjNrSkxBMXJaazRWeDJMTkRUOUlXcVVyZ0p0WnpDU0lDOVlRPT0='
Client lib initialized and running
Connect status changed: 1 1 0
2016-08-16 10:14:20.926635|DEVELOP |PktHandler | |Puzzle solve time: 7
Connect status changed: 1 2 0
Connect status changed: 1 3 0
Connect status changed: 1 4 0
我也遇到了不可重复的随机错误:
Fatal Python error: GC object already tracked
和
Fatal Python error: PyThreadState_Get: no current thread
由于没有可验证的例子,所以有点猜测。
如果从 C 库 (ts3client_*) 创建的线程调用这些处理程序函数,则在调用 python 函数时尚未正确获取 GIL。
加with gil
赞
cdef void onConnectStatusChangeEvent(uint64 serverConnectionHandlerID,
int newStatus,
unsigned int errorNumber) with gil:
可能会有帮助。
__main__()
末尾也没有代码,最好是主线程至少是空闲的
if (error != ERROR_ok):
print("Error connecting to server: %d\n"% error)
print("Client lib initialized and running\n")
可以在打印调用之后添加以下行以进行快速测试
import time
while True:
time.sleep(1.0)