The following program triggers an assert in the debug mode of gnu stl. dgoncharov@localhost ~/asiobug $ cat main.cpp #include #include #include int main() { boost::asio::io_service ios; boost::asio::posix::stream_descriptor sd(ios); } dgoncharov@localhost ~/asiobug $ dgoncharov@localhost ~/asiobug $ rm core dgoncharov@localhost ~/asiobug $ rm a.out dgoncharov@localhost ~/asiobug $ g++ -ggdb main.cpp -lboost_thread -lboost_system dgoncharov@localhost ~/asiobug $ ./a.out dgoncharov@localhost ~/asiobug $ g++ -ggdb -D_GLIBCXX_DEBUG main.cpp -lboost_thread -lboost_system dgoncharov@localhost ~/asiobug $ ./a.out /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4/debug/safe_iterator.h:126: error: attempt to copy-construct an iterator from a singular iterator. Objects involved in the operation: iterator "this" @ 0x0x7ffffe7bb9b0 { type = N11__gnu_debug14_Safe_iteratorINSt6__norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEENSt7__debug4listISB_SaISB_EEEEE (mutable iterator); state = singular; } iterator "other" @ 0x0x7ffffe7bbaa0 { type = N11__gnu_debug14_Safe_iteratorINSt6__norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEENSt7__debug4listISB_SaISB_EEEEE (mutable iterator); state = singular; } Aborted (core dumped) dgoncharov@localhost ~/asiobug $ gdb ./a.out ./core GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu"... warning: Can't read pathname for load map: Input/output error. Reading symbols from /usr/lib64/libboost_thread-mt-1_39.so.1.39.0...done. Loaded symbols for /usr/lib/libboost_thread-mt-1_39.so.1.39.0 Reading symbols from /usr/lib64/libboost_system-1_39.so.1.39.0...done. Loaded symbols for /usr/lib/libboost_system-1_39.so.1.39.0 Reading symbols from /usr/lib64/gcc/x86_64-pc-linux-gnu/4.4.1/libstdc++.so.6...done. Loaded symbols for /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/libstdc++.so.6 Reading symbols from /lib64/libm.so.6...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib64/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /lib64/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib64/libpthread.so.0...done. Loaded symbols for /lib/libpthread.so.0 Reading symbols from /lib64/librt.so.1...done. Loaded symbols for /lib/librt.so.1 Reading symbols from /lib64/ld-linux-x86-64.so.2...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Core was generated by `./a.out'. Program terminated with signal 6, Aborted. [New process 25569] #0 0x00007f0e8c3b6405 in raise () from /lib/libc.so.6 (gdb) info thr * 1 process 25569 0x00007f0e8c3b6405 in raise () from /lib/libc.so.6 (gdb) bt #0 0x00007f0e8c3b6405 in raise () from /lib/libc.so.6 #1 0x00007f0e8c3b8013 in abort () from /lib/libc.so.6 #2 0x00007f0e8cbff0e3 in __gnu_debug::_Error_formatter::_M_error () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/libstdc++.so.6 #3 0x00000000004097fb in _Safe_iterator (this=0x7ffffe7bb9b0, __x=@0x7ffffe7bbaa0) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4/debug/safe_iterator.h:123 #4 0x000000000040d288 in bucket_type (this=0x7ffffe7bb9b0) at /usr/include/boost/asio/detail/hash_map.hpp:277 #5 0x000000000040de98 in std::__debug::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::resize (this=0x234c240, __sz=3, __c= {first = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x0, _M_version = 0, _M_prior = 0x0, _M_next = 0x0}, _M_current = {_M_node = 0x0}}, last = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x0, _M_version = 0, _M_prior = 0x0, _M_next = 0x0}, _M_current = {_M_node = 0x0}}}) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4/debug/vector:233 #6 0x000000000040d33a in boost::asio::detail::hash_map::op_base*>::rehash (this=0x234c1e8, num_buckets=3) at /usr/include/boost/asio/detail/hash_map.hpp:221 #7 0x000000000040cad0 in hash_map (this=0x234c1e8) at /usr/include/boost/asio/detail/hash_map.hpp:67 #8 0x000000000040bd03 in reactor_op_queue (this=0x234c1e0) at /usr/include/boost/asio/detail/reactor_op_queue.hpp:42 #9 0x000000000040ac6a in epoll_reactor (this=0x234c180, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/detail/epoll_reactor.hpp:78 #10 0x0000000000409dc3 in boost::asio::detail::service_registry::use_service > (this=0x234c010) at /usr/include/boost/asio/detail/service_registry.hpp:109 #11 0x0000000000408e6c in boost::asio::use_service > (ios=@0x7ffffe7bbfa0) at /usr/include/boost/asio/impl/io_service.ipp:195 #12 0x00000000004084f7 in reactive_descriptor_service (this=0x234c140, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/detail/reactive_descriptor_service.hpp:83 #13 0x0000000000407923 in boost::asio::detail::service_registry::use_service > > (this=0x234c010) at /usr/include/boost/asio/detail/service_registry.hpp:109 #14 0x0000000000406b13 in boost::asio::use_service > > (ios=@0x7ffffe7bbfa0) at /usr/include/boost/asio/impl/io_service.ipp:195 #15 0x000000000040616d in stream_descriptor_service (this=0x234c100, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/posix/stream_descriptor_service.hpp:94 #16 0x000000000040a081 in boost::asio::detail::service_registry::use_service (this=0x234c010) at /usr/include/boost/asio/detail/service_registry.hpp:109 #17 0x0000000000409098 in boost::asio::use_service (ios=@0x7ffffe7bbfa0) at /usr/include/boost/asio/impl/io_service.ipp:195 #18 0x00000000004087bd in basic_io_object (this=0x7ffffe7bbf90, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/basic_io_object.hpp:72 #19 0x0000000000407b2f in basic_descriptor (this=0x7ffffe7bbf90, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/posix/basic_descriptor.hpp:63 #20 0x0000000000406c47 in basic_stream_descriptor (this=0x7ffffe7bbf90, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/posix/basic_stream_descriptor.hpp:68 #21 0x00000000004038cf in main () at main.cpp:9 (gdb)