包括Boost ASIO与Amazon Gamelift SDK冲突



如果我在头文件中包含boost ASIO而没有实际使用boost::ASIO,那么在我调用Aws::GameLift::Server::InitSDK()的任何时候,应用程序都将从另一个线程崩溃。这样的事情怎么可能发生?

Exception thrown at 0x00007FFC4ADEA6AB (ntdll.dll) in MyApp.exe: 0xC0000005: Access violation writing location 0x0000000100000023.

ntdll.dll!RtlpWaitOnCriticalSection()   Unknown
ntdll.dll!RtlpEnterCriticalSectionContended()   Unknown
ntdll.dll!RtlEnterCriticalSection() Unknown
MyApp.exe!boost::asio::detail::win_iocp_io_service::do_add_timer_queue(class boost::asio::detail::timer_queue_base &)   C++
MyApp.exe!boost::asio::waitable_timer_service<struct std::chrono::steady_clock,struct boost::asio::wait_traits<struct std::chrono::steady_clock> >::waitable_timer_service<struct std::chrono::steady_clock,struct boost::asio::wait_traits<struct std::chrono::steady_clock> >(class boost::asio::io_service &)    C++
MyApp.exe!boost::asio::detail::service_registry::create<class boost::asio::waitable_timer_service<struct std::chrono::steady_clock,struct boost::asio::wait_traits<struct std::chrono::steady_clock> > >(class boost::asio::io_service &)   C++
MyApp.exe!boost::asio::detail::service_registry::do_use_service(const boost::asio::io_service::service::key & key, boost::asio::io_service::service *(*)(boost::asio::io_service &) factory) Line 124   C++
MyApp.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block, boost::system::error_code & ec) Line 397 C++
MyApp.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & ec) Line 159    C++ 

这是我的include-只要将其放在任何头文件的顶部,就会在InitSDK调用后触发异常。

#define BOOST_ASIO_HAS_MOVE
#define CreateEvent CreateEventA
#include <boost/asio.hpp>
#undef CreateEvent

我正在使用:

  • Visual Studio 2015工具集v140

  • Boost 1.52.0

  • Windows 8.1 SDK(运行Windows 10(

我已经研究了这个问题:win_mutex锁定中的boost::asio::io_service崩溃

当我添加#define BOOST_ASIO_DISABLE_IOCP时,异常会发生变化,调用堆栈在主线程上。这让我相信它与套接字服务的不同实现有关,具体取决于使用了哪些定义。

MyApp.exe!boost::asio::detail::win_iocp_socket_service_base::construct(struct boost::asio::detail::win_iocp_socket_service_base::base_implementation_type &)    C++
MyApp.exe!boost::asio::basic_io_object<class boost::asio::socket_acceptor_service<class boost::asio::ip::tcp>,1>::basic_io_object<class boost::asio::socket_acceptor_service<class boost::asio::ip::tcp>,1>(class boost::asio::io_service &)    C++
MyApp.exe!std::make_shared<class boost::asio::basic_socket_acceptor<class boost::asio::ip::tcp,class boost::asio::socket_acceptor_service<class boost::asio::ip::tcp> >,class boost::reference_wrapper<class boost::asio::io_service> const >(class boost::reference_wrapper<class boost::asio::io_service> const &&)   C++
MyApp.exe!websocketpp::transport::asio::endpoint<struct websocketpp::config::asio_client::transport_config>::init_asio(class boost::asio::io_service *,class std::error_code &) C++
MyApp.exe!websocketpp::transport::asio::endpoint<struct websocketpp::config::asio_client::transport_config>::init_asio(class boost::asio::io_service *) C++
MyApp.exe!sio::client_impl::client_impl(void)   C++
MyApp.exe!sio::client::client(void) C++
MyApp.exe!Aws::GameLift::Internal::GameLiftServerState::InitializeNetworking(void)  Unknown
MyApp.exe!Aws::GameLift::Server::InitSDK(void)  Unknown

我的Gamelift SDK版本似乎使用的是Boost 1.61,这与我在主项目中使用的Boost 1.52相冲突。

我将Boost的使用升级到1.61,以匹配他们的使用,突然间——Gamelift也不例外。惊喜

相关内容

  • 没有找到相关文章

最新更新