进程结束,退出码为-1073741819 (0xC0000005) (Cython, TeamSpeak3)



我现在的目标是创建team speak 3 manager服务(通过通道和其他通道切换用户):所以我创建了TS3 SDK库的包装器(用Cython for Python包装):https://mega.nz/#!pQdFjIwD!1vg8DPsFtYR4icVqWXzvpdbAQ47-n-aPz2niRkTU4fY(主模块: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 %sn', b'xd0x9cxd0xb8xd0xbaxd1x80xd0xbexd1x84xd0xbexd0xbd (xd0xa3xd1x81xd1x82xd1x80xd0xbexd0xb9xd1x81xd1x82xd0xb2xd0xbe xd1x81 xd0xbfxd0xbexd0xb4xd0xb4xd0xb5xd1x80xd0xb6xd0xbaxd0xbexd0xb9 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 %sn', b'xd0x94xd0xb8xd0xbdxd0xb0xd0xbcxd0xb8xd0xbaxd0xb8 (xd0xa3xd1x81xd1x82xd1x80xd0xbexd0xb9xd1x81xd1x82xd0xb2xd0xbe xd1x81 xd0xbfxd0xbexd0xb4xd0xb4xd0xb5xd1x80xd0xb6xd0xbaxd0xbexd0xb9 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 onConnectStatusChang‌​eEvent(uint64 serverConnectionHand‌​lerID,
                                     int newStatus, 
                                     unsigned int errorNumber) with gil:

也许会有帮助。

__main__()的末尾也没有代码,主线程至少是空闲的可能会更好。

if (error != ERROR_ok):
    print("Error connecting to server: %dn"% error)
print("Client lib initialized and runningn")

可以在print调用之后添加以下行以进行快速测试

import time
while True:
    time.sleep(1.0)

相关内容

  • 没有找到相关文章

最新更新