2009-08-15 5 views
0

MacOSX 10.5의 Boost asio 예제에서 blocking_udp_echo_server.cpp를 실행하려고합니다.boost asio 예에서 Mac OS X에서 충돌이 발생합니다.

그러나 충돌 :

(gdb) bt 
#0 0x918c3e42 in __kill() 
#1 0x918c3e34 in kill$UNIX2003() 
#2 0x9193623a in raise() 
#3 0x91942679 in abort() 
#4 0x940d96f9 in __gnu_debug::_Error_formatter::_M_error() 
#5 0x0000ada6 in 
__gnu_debug::_Safe_iterator<__gnu_norm::_List_iterator<std::pair<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*> >, 
__gnu_debug_def::list<std::pair<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>, 
std::allocator<std::pair<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*> > > 
>::_Safe_iterator (this=0x100420, [email protected]) at 
debug/safe_iterator.h:124 
#6 0x00010195 in boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type::bucket_type 
(this=0x100420) at hash_map.hpp:277 
#7 0x0001291d in std::_Construct<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
(__p=0x100420, [email protected]) at stl_construct.h:81 
#8 0x00012edd in 
std::__uninitialized_fill_n_aux<__gnu_cxx::__normal_iterator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type*, 
__gnu_norm::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> > 
>, unsigned long, boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
(__first={_M_current = 0x100420}, __n=3, [email protected]) at 
stl_uninitialized.h:194 
#9 0x00012f67 in 
std::uninitialized_fill_n<__gnu_cxx::__normal_iterator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type*, 
__gnu_norm::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> > 
>, unsigned long, boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
(__first={_M_current = 0x100420}, __n=3, [email protected]) at 
stl_uninitialized.h:218 
#10 0x00012f8f in 
std::__uninitialized_fill_n_a<__gnu_cxx::__normal_iterator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type*, 
__gnu_norm::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> > 
>, unsigned long, boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
(__first={_M_current = 0x100420}, __n=3, [email protected]) at 
stl_uninitialized.h:310 
#11 0x000134ba in 
__gnu_norm::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
>::_M_fill_insert (this=0x1002f0, __position={_M_current = 0x0}, 
__n=3, [email protected]) at vector.tcc:365 
#12 0x00013760 in 
__gnu_norm::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
>::insert (this=0x1002f0, __position={_M_current = 0x0}, __n=3, 
[email protected]) at stl_vector.h:658 
#13 0x00013807 in 
__gnu_norm::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
>::resize (this=0x1002f0, __new_size=3, [email protected]) at 
stl_vector.h:427 
#14 0x000138c0 in 
__gnu_debug_def::vector<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type, 
std::allocator<boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::bucket_type> 
>::resize (this=0x1002f0, __sz=3, [email protected]) at debug/vector:169 
#15 0x0001400e in boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::rehash 
(this=0x1002c4, num_buckets=3) at hash_map.hpp:221 
#16 0x0001443b in boost::asio::detail::hash_map<int, 
boost::asio::detail::reactor_op_queue<int>::op_base*>::hash_map 
(this=0x1002c4) at hash_map.hpp:67 
#17 0x000144c4 in 
boost::asio::detail::reactor_op_queue<int>::reactor_op_queue 
(this=0x1002c0) at reactor_op_queue.hpp:42 
#18 0x00014574 in 
boost::asio::detail::kqueue_reactor<false>::kqueue_reactor 
(this=0x100270, [email protected]) at kqueue_reactor.hpp:86 
#19 0x00014850 in 
boost::asio::detail::service_registry::use_service<boost::asio::detail::kqueue_reactor<false> 
> (this=0x100180) at service_registry.hpp:109 
#20 0x0001499d in 
boost::asio::use_service<boost::asio::detail::kqueue_reactor<false> > 
([email protected]) at impl/io_service.ipp:195 
#21 0x00014abd in 
boost::asio::detail::reactive_socket_service<boost::asio::ip::udp, 
boost::asio::detail::kqueue_reactor<false> >::reactive_socket_service 
(this=0x100250, [email protected]) at 
reactive_socket_service.hpp:111 
#22 0x00014b94 in 
boost::asio::detail::service_registry::use_service<boost::asio::detail::reactive_socket_service<boost::asio::ip::udp, 
boost::asio::detail::kqueue_reactor<false> > > (this=0x100180) at 
service_registry.hpp:109 
#23 0x00014ce1 in 
boost::asio::use_service<boost::asio::detail::reactive_socket_service<boost::asio::ip::udp, 
boost::asio::detail::kqueue_reactor<false> > > ([email protected]) at 
impl/io_service.ipp:195 
#24 0x00014d25 in 
boost::asio::datagram_socket_service<boost::asio::ip::udp>::datagram_socket_service 
(this=0x100230, [email protected]) at 
datagram_socket_service.hpp:95 
#25 0x00014dee in 
boost::asio::detail::service_registry::use_service<boost::asio::datagram_socket_service<boost::asio::ip::udp> 
> (this=0x100180) at service_registry.hpp:109 
#26 0x00014f3b in 
boost::asio::use_service<boost::asio::datagram_socket_service<boost::asio::ip::udp> 
> ([email protected]) at impl/io_service.ipp:195 
#27 0x00014f61 in 
boost::asio::basic_io_object<boost::asio::datagram_socket_service<boost::asio::ip::udp> 
>::basic_io_object (this=0xbffff6a4, [email protected]) at 
basic_io_object.hpp:72 
#28 0x00014fd3 in boost::asio::basic_socket<boost::asio::ip::udp, 
boost::asio::datagram_socket_service<boost::asio::ip::udp> 
>::basic_socket (this=0xbffff6a4, [email protected], 
[email protected]) at basic_socket.hpp:108 
#29 0x000150b5 in 
boost::asio::basic_datagram_socket<boost::asio::ip::udp, 
boost::asio::datagram_socket_service<boost::asio::ip::udp> 
>::basic_datagram_socket (this=0xbffff6a4, [email protected], 
[email protected]) at basic_datagram_socket.hpp:107 
#30 0x00002022 in server ([email protected], port=8090) at 
/Users/n179911/Documents/ServerXCode/main.cpp:21 
#31 0x0000217a in main (argc=2, argv=0xbffff7e8) at 
/Users/n179911/Documents/ServerXCode/main.cpp:47 
(gdb) 

어떤 사람이 어떤 생각을 가지고 역 추적에서

From the console: 
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127: 
    error: attempt to copy-construct an iterator from a singular iterator. 

Objects involved in the operation: 
iterator "this" @ 0x0x100420 { 
type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE 
(mutable iterator); 
state = singular; 
} 
iterator "other" @ 0x0xbfffee64 { 
type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE 
(mutable iterator); 
state = singular; 
} 
Program received signal: “SIGABRT”. 

?

+0

어떤 컴파일러 옵션이 있습니까? 어떤 최적화 수준? – LiraNuna

+0

Xcode를 사용하여 코드를 컴파일합니다. 기본 컴파일러 옵션과 최적화 수준을 사용하고 있습니다. – n179911

+0

중복 된 http://stackoverflow.com/questions/1183270/problem-in-running-boost-eample-blocking-udp-echo-client-on-macosx. 그 질문에 대한 내 대답을 보라. boost :: asio에서 알려진 버그입니다. – ablaeul

답변

0

나는 singluar 값에 대한 유일한 보증 된 동작은 비정규 값을 할당하는 것임을 이해하는 한.

내가 furhter probem를 파악하기 위해 다음과 같은 방법을 시도 할 것 :

  1. 을 종종 리드를 무거운 최적화를 사용하여 내가 LIB 코드가 괜찮다는 생각 때문에 나는 인상이 문제는 빌드 프로세스에 더 관련이 얻을 드물게 디폴트 최적화가 문제가 될 수 있습니다. 모든 최적화를 제거하십시오.

  2. 문제가 될 수있는 코드로 다른 컴파일러를 사용하여 부스트를 작성하는 경우. 같은 컴파일러로 직접 빌드하지 않았다면 시도해보십시오. 빌드하지 않을 수도 있습니다.

  3. 첫 번째 컴파일러 개정판 (4.0.0, 3.0.0 등)은 버그가 많기 때문에 (적어도 GNU cc의 경우에는) 버그가있을 수 있습니다. 4.1 또는 뭔가를 시도하십시오.