1 | The following program triggers an assert in the debug mode of gnu stl.
|
---|
2 |
|
---|
3 | dgoncharov@localhost ~/asiobug $ cat main.cpp
|
---|
4 | #include <unistd.h>
|
---|
5 | #include <boost/asio/io_service.hpp>
|
---|
6 | #include <boost/asio/posix/stream_descriptor.hpp>
|
---|
7 |
|
---|
8 | int main()
|
---|
9 | {
|
---|
10 | boost::asio::io_service ios;
|
---|
11 | boost::asio::posix::stream_descriptor sd(ios);
|
---|
12 | }
|
---|
13 |
|
---|
14 |
|
---|
15 | dgoncharov@localhost ~/asiobug $
|
---|
16 | dgoncharov@localhost ~/asiobug $ rm core
|
---|
17 | dgoncharov@localhost ~/asiobug $ rm a.out
|
---|
18 | dgoncharov@localhost ~/asiobug $ g++ -ggdb main.cpp -lboost_thread -lboost_system
|
---|
19 | dgoncharov@localhost ~/asiobug $ ./a.out
|
---|
20 | dgoncharov@localhost ~/asiobug $ g++ -ggdb -D_GLIBCXX_DEBUG main.cpp -lboost_thread -lboost_system
|
---|
21 | dgoncharov@localhost ~/asiobug $ ./a.out
|
---|
22 | /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/include/g++-v4/debug/safe_iterator.h:126:
|
---|
23 | error: attempt to copy-construct an iterator from a singular iterator.
|
---|
24 |
|
---|
25 | Objects involved in the operation:
|
---|
26 | iterator "this" @ 0x0x7ffffe7bb9b0 {
|
---|
27 | type = N11__gnu_debug14_Safe_iteratorINSt6__norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEENSt7__debug4listISB_SaISB_EEEEE (mutable iterator);
|
---|
28 | state = singular;
|
---|
29 | }
|
---|
30 | iterator "other" @ 0x0x7ffffe7bbaa0 {
|
---|
31 | type = N11__gnu_debug14_Safe_iteratorINSt6__norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEENSt7__debug4listISB_SaISB_EEEEE (mutable iterator);
|
---|
32 | state = singular;
|
---|
33 | }
|
---|
34 | Aborted (core dumped)
|
---|
35 | dgoncharov@localhost ~/asiobug $ gdb ./a.out ./core
|
---|
36 | GNU gdb 6.8
|
---|
37 | Copyright (C) 2008 Free Software Foundation, Inc.
|
---|
38 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
---|
39 | This is free software: you are free to change and redistribute it.
|
---|
40 | There is NO WARRANTY, to the extent permitted by law. Type "show copying"
|
---|
41 | and "show warranty" for details.
|
---|
42 | This GDB was configured as "x86_64-pc-linux-gnu"...
|
---|
43 |
|
---|
44 | warning: Can't read pathname for load map: Input/output error.
|
---|
45 | Reading symbols from /usr/lib64/libboost_thread-mt-1_39.so.1.39.0...done.
|
---|
46 | Loaded symbols for /usr/lib/libboost_thread-mt-1_39.so.1.39.0
|
---|
47 | Reading symbols from /usr/lib64/libboost_system-1_39.so.1.39.0...done.
|
---|
48 | Loaded symbols for /usr/lib/libboost_system-1_39.so.1.39.0
|
---|
49 | Reading symbols from /usr/lib64/gcc/x86_64-pc-linux-gnu/4.4.1/libstdc++.so.6...done.
|
---|
50 | Loaded symbols for /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/libstdc++.so.6
|
---|
51 | Reading symbols from /lib64/libm.so.6...done.
|
---|
52 | Loaded symbols for /lib/libm.so.6
|
---|
53 | Reading symbols from /lib64/libgcc_s.so.1...done.
|
---|
54 | Loaded symbols for /lib/libgcc_s.so.1
|
---|
55 | Reading symbols from /lib64/libc.so.6...done.
|
---|
56 | Loaded symbols for /lib/libc.so.6
|
---|
57 | Reading symbols from /lib64/libpthread.so.0...done.
|
---|
58 | Loaded symbols for /lib/libpthread.so.0
|
---|
59 | Reading symbols from /lib64/librt.so.1...done.
|
---|
60 | Loaded symbols for /lib/librt.so.1
|
---|
61 | Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
|
---|
62 | Loaded symbols for /lib64/ld-linux-x86-64.so.2
|
---|
63 | Core was generated by `./a.out'.
|
---|
64 | Program terminated with signal 6, Aborted.
|
---|
65 | [New process 25569]
|
---|
66 | #0 0x00007f0e8c3b6405 in raise () from /lib/libc.so.6
|
---|
67 | (gdb) info thr
|
---|
68 | * 1 process 25569 0x00007f0e8c3b6405 in raise () from /lib/libc.so.6
|
---|
69 | (gdb) bt
|
---|
70 | #0 0x00007f0e8c3b6405 in raise () from /lib/libc.so.6
|
---|
71 | #1 0x00007f0e8c3b8013 in abort () from /lib/libc.so.6
|
---|
72 | #2 0x00007f0e8cbff0e3 in __gnu_debug::_Error_formatter::_M_error () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1/libstdc++.so.6
|
---|
73 | #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
|
---|
74 | #4 0x000000000040d288 in bucket_type (this=0x7ffffe7bb9b0) at /usr/include/boost/asio/detail/hash_map.hpp:277
|
---|
75 | #5 0x000000000040de98 in std::__debug::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=0x234c240, __sz=3, __c=
|
---|
76 | {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
|
---|
77 | #6 0x000000000040d33a in boost::asio::detail::hash_map<int, boost::asio::detail::reactor_op_queue<int>::op_base*>::rehash (this=0x234c1e8, num_buckets=3) at /usr/include/boost/asio/detail/hash_map.hpp:221
|
---|
78 | #7 0x000000000040cad0 in hash_map (this=0x234c1e8) at /usr/include/boost/asio/detail/hash_map.hpp:67
|
---|
79 | #8 0x000000000040bd03 in reactor_op_queue (this=0x234c1e0) at /usr/include/boost/asio/detail/reactor_op_queue.hpp:42
|
---|
80 | #9 0x000000000040ac6a in epoll_reactor (this=0x234c180, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/detail/epoll_reactor.hpp:78
|
---|
81 | #10 0x0000000000409dc3 in boost::asio::detail::service_registry::use_service<boost::asio::detail::epoll_reactor<false> > (this=0x234c010) at /usr/include/boost/asio/detail/service_registry.hpp:109
|
---|
82 | #11 0x0000000000408e6c in boost::asio::use_service<boost::asio::detail::epoll_reactor<false> > (ios=@0x7ffffe7bbfa0) at /usr/include/boost/asio/impl/io_service.ipp:195
|
---|
83 | #12 0x00000000004084f7 in reactive_descriptor_service (this=0x234c140, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/detail/reactive_descriptor_service.hpp:83
|
---|
84 | #13 0x0000000000407923 in boost::asio::detail::service_registry::use_service<boost::asio::detail::reactive_descriptor_service<boost::asio::detail::epoll_reactor<false> > > (this=0x234c010)
|
---|
85 | at /usr/include/boost/asio/detail/service_registry.hpp:109
|
---|
86 | #14 0x0000000000406b13 in boost::asio::use_service<boost::asio::detail::reactive_descriptor_service<boost::asio::detail::epoll_reactor<false> > > (ios=@0x7ffffe7bbfa0)
|
---|
87 | at /usr/include/boost/asio/impl/io_service.ipp:195
|
---|
88 | #15 0x000000000040616d in stream_descriptor_service (this=0x234c100, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/posix/stream_descriptor_service.hpp:94
|
---|
89 | #16 0x000000000040a081 in boost::asio::detail::service_registry::use_service<boost::asio::posix::stream_descriptor_service> (this=0x234c010) at /usr/include/boost/asio/detail/service_registry.hpp:109
|
---|
90 | #17 0x0000000000409098 in boost::asio::use_service<boost::asio::posix::stream_descriptor_service> (ios=@0x7ffffe7bbfa0) at /usr/include/boost/asio/impl/io_service.ipp:195
|
---|
91 | #18 0x00000000004087bd in basic_io_object (this=0x7ffffe7bbf90, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/basic_io_object.hpp:72
|
---|
92 | #19 0x0000000000407b2f in basic_descriptor (this=0x7ffffe7bbf90, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/posix/basic_descriptor.hpp:63
|
---|
93 | #20 0x0000000000406c47 in basic_stream_descriptor (this=0x7ffffe7bbf90, io_service=@0x7ffffe7bbfa0) at /usr/include/boost/asio/posix/basic_stream_descriptor.hpp:68
|
---|
94 | #21 0x00000000004038cf in main () at main.cpp:9
|
---|
95 | (gdb)
|
---|
96 |
|
---|