libtorrent和tcp ::受体在Windows上崩溃并违反访问
libtorrent and tcp::acceptor crashes with access violation on Windows
libtorrent版本(或分支):主/libtorrent-1_1_5
平台/体系结构:win32
编译器和编译器版本:MSVC-14.0
提升版本:BOOST-1.65.1
下面的代码始终导致崩溃。
#include "libtorrent/session.hpp"
#include <chrono>
#include <thread>
using namespace std;
int main()
{
libtorrent::session session;
boost::asio::io_service io_service;
boost::asio::ip::tcp::acceptor acceptor(io_service);
std::this_thread::sleep_for(chrono::seconds(15));
return 0;
}
呼叫堆栈:
> test-crow-libtorrent.exe!boost::asio::detail::win_iocp_socket_service_base::do_open(struct boost::asio::detail::win_iocp_socket_service_base::base_implementation_type &,int,int,int,class boost::system::error_code &) C++
test-crow-libtorrent.exe!libtorrent::aux::session_impl::setup_listener(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::asio::ip::tcp const &,int,int,class boost::system::error_code &) C++
test-crow-libtorrent.exe!libtorrent::aux::session_impl::open_listen_port(void) C++
test-crow-libtorrent.exe!libtorrent::aux::session_impl::init(class boost::shared_ptr<struct libtorrent::settings_pack>) C++
test-crow-libtorrent.exe!boost::_mfi::mf1<void,struct libtorrent::aux::session_impl,class boost::shared_ptr<struct libtorrent::settings_pack> >::operator()(struct libtorrent::aux::session_impl *,class boost::shared_ptr<struct libtorrent::settings_pack>) C++
test-crow-libtorrent.exe!boost::asio::asio_handler_invoke<class boost::_bi::bind_t<void,class boost::_mfi::mf1<void,struct libtorrent::aux::session_impl,class boost::shared_ptr<struct libtorrent::settings_pack> >,class boost::_bi::list2<class boost::_bi::value<struct libtorrent::aux::session_impl *>,class boost::_bi::value<class boost::shared_ptr<struct libtorrent::settings_pack> > > > >(class boost::_bi::bind_t<void,class boost::_mfi::mf1<void,struct libtorrent::aux::session_impl,class boost::shared_ptr<struct libtorrent::settings_pack> >,class boost::_bi::list2<class boost::_bi::value<struct libtorrent::aux::session_impl *>,class boost::_bi::value<class boost::shared_ptr<struct libtorrent::settings_pack> > > > &,...) C++
test-crow-libtorrent.exe!boost::asio::detail::completion_handler<class boost::_bi::bind_t<void,class boost::_mfi::mf1<void,struct libtorrent::aux::session_impl,class boost::shared_ptr<struct libtorrent::settings_pack> >,class boost::_bi::list2<class boost::_bi::value<struct libtorrent::aux::session_impl *>,class boost::_bi::value<class boost::shared_ptr<struct libtorrent::settings_pack> > > > >::do_complete(class boost::asio::detail::win_iocp_io_service *,class boost::asio::detail::win_iocp_operation *,class boost::system::error_code const &,unsigned int) C++
test-crow-libtorrent.exe!boost::asio::detail::win_iocp_io_service::do_one(bool,class boost::system::error_code &) C++
test-crow-libtorrent.exe!boost::asio::detail::win_iocp_io_service::run(class boost::system::error_code &) C++
test-crow-libtorrent.exe!boost::asio::io_service::run(void) C++
test-crow-libtorrent.exe!thread_start<unsigned int (__stdcall*)(void *)>(void * const parameter) Line 115 C++
kernel32.dll!@BaseThreadInitThunk@12�() Unknown
ntdll.dll!__RtlUserThreadStart() Unknown
ntdll.dll!__RtlUserThreadStart@8�() Unknown
libtorrent编译选项:
toolset=msvc-14.0 boost-link=static dht=on encryption=on mutable-torrents=on crypto=openssl openssl-version=1.1 link=static runtime-link=static variant=debug,release i2p=on
崩溃仅发生在释放构建上。
谁能帮我吗?
这很可能是由构建libtorrent和带有链接兼容选项的测试应用程序引起的。如果libtorrent在静态上与运行时链接,则您有责任确保与之链接的任何内容也可以。
另外,您可以使用适当的构建工具来执行链接兼容(例如Boost-Build)。
问题是在预处理器中。当您使用Boost-Build以外的工具构建应用程序(使用LibTorrent)时,需要添加BOOST_ASIO_ENABLE_CANCELIO
。
在这里您可以找到有关此问题的更多信息。
相关文章:
- 使用 g++7 构建的代码在访问未对齐的内存时崩溃
- 访问提升:shared_ptr 主范围外崩溃,断言失败:px != 0.指针的正确用法是什么?
- 当键是虚拟继承中涉及的基类指针时,对 std::unordered_map 项的访问崩溃
- 在目标计算机上访问 POSIX 信号灯时出现可执行文件崩溃(SEGV_MAPERR)
- 无法访问的代码如何导致我的程序崩溃?
- 使用向量的函数崩溃,调试器说访问冲突读取位置
- 我的单例中的数组在离开函数后没有保留信息,然后在尝试再次访问信息时崩溃
- 为什么 CUDA 在访问类成员时崩溃?
- 将多面体转换为nef(违反访问)时,与CGAL崩溃
- Windows C++程序中的访问冲突是否总是立即崩溃
- libtorrent和tcp ::受体在Windows上崩溃并违反访问
- 程序在访问shared_ptr持有QString时崩溃
- 访问使用 def 文件导出的静态变量时崩溃
- 程序在尝试创建和访问二维矢量时崩溃
- C 程序在出口时崩溃,内存中的访问违规
- 简单的Logger类VSNPrintf正在随着读取访问违规行为而崩溃
- Dx11 访问 XMMATRIX 时崩溃
- 如何调试C++非托管代码中的较低级别文件访问异常/崩溃
- MEMCPY 后崩溃:访问冲突读取位置
- c++, WIN32, WndProc到成员函数崩溃(访问冲突0x88)