We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please use this template for reporting suspected bugs or requests for help.
problem: code was written in 2018-07-04, until 2020-05-13, eveny thing is fine. 2020-05-13, process stopped by systemd, but was hang in zmq_ctx_term
zmq socket create source code: void* s = NULL; int r = 0; int linger = 2; int ipv6_support = 0; char end_point[END_POINT];
if (strrchr(address, ':') != NULL) { ipv6_support = 1; // enable ipv6 } if (ipv6_support == 0) { snprintf(end_point, END_POINT, ZMQ_IPV4_ENDPOINT, address, port); } else { snprintf(end_point, END_POINT, ZMQ_IPV6_ENDPOINT, address, port); } s = zmq_socket(z_ctx, ZMQ_REQ); if (s == NULL) { errno = ECREATEZSOCK; return NULL; } if (ipv6_support == 1) { zmq_setsockopt(s, ZMQ_IPV6, &ipv6_support, sizeof(ipv6_support)); } zmq_setsockopt(s, ZMQ_LINGER, &linger, sizeof(linger));
I set zmq linger to 2, not 0
GDB bt: (gdb) info thread Id Target Id Frame 18 Thread 0x7f16f13d3700 (LWP 2153208) "log" 0x00007f16f3b25995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 17 Thread 0x7f16ef3ff700 (LWP 2153225) "io-worker-0" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 16 Thread 0x7f16eebfe700 (LWP 2153226) "io-worker-1" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 15 Thread 0x7f16edbff700 (LWP 2153229) "io-worker-2" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 14 Thread 0x7f16ec7ff700 (LWP 2153232) "hb-worker-0" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 13 Thread 0x7f16eaffe700 (LWP 2153266) "service" 0x00007f16f3b25d42 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 12 Thread 0x7f16ea7fd700 (LWP 2153267) "admin_socket" 0x00007f16f2c06f0d in poll () from /lib64/libc.so.6 11 Thread 0x7f16e91f4700 (LWP 2154163) "ceph-osd" 0x00007f16f5a11644 in io_getevents_0_4 () from /opt/h3c/lib/libaio.so.1 10 Thread 0x7f16e89f3700 (LWP 2154164) "ceph-osd" 0x00007f16f3b27afb in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0 9 Thread 0x7f16da3fe700 (LWP 2154259) "ceph-osd" 0x00007f16f3b27afb in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0 8 Thread 0x7f16f6d14e80 (LWP 2155828) "ceph-osd" 0x00007f16f4f6fe67 in timer_helper_thread () from /lib64/librt.so.1 7 Thread 0x7f16857ff700 (LWP 2191105) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 6 Thread 0x7f168b7ff700 (LWP 2191106) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 5 Thread 0x7f1684ffe700 (LWP 2191110) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 4 Thread 0x7f16833fe700 (LWP 2191113) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 3 Thread 0x7f1683bff700 (LWP 2350307) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 2 Thread 0x7f167fffe700 (LWP 2350308) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6 1 Thread 0x7f16f6d38e80 (LWP 2151812) "ceph-osd" 0x00007f16f2c06f0d in poll () from /lib64/libc.so.6 (gdb) list 1 req_adapter.c: No such file or directory. (gdb) bt #0 0x00007f16f2c06f0d in poll () from /lib64/libc.so.6 #1 0x00007f16f66fa8ba in zmq::signaler_t::wait (this=this@entry=0x7f16f1dfaef8, timeout=timeout@entry=-1) at signaler.cpp:173 #2 0x00007f16f66ec81f in zmq::mailbox_t::recv (this=this@entry=0x7f16f1dfae98, cmd_=cmd_@entry=0x7ffd937625a0, timeout_=timeout_@entry=-1) at mailbox.cpp:72 #3 0x00007f16f66e3e2c in zmq::ctx_t::terminate (this=0x7f16f1dfae00) at ctx.cpp:142 #4 0x00007f16f6927ef1 in destroy_zmq_ctx () from /opt/h3c/lib/libalarm.so #5 0x00005575f9271367 in main () (gdb) down Bottom (innermost) frame selected; you cannot go down. (gdb) up #1 0x00007f16f66fa8ba in zmq::signaler_t::wait (this=this@entry=0x7f16f1dfaef8, timeout_=timeout_@entry=-1) at signaler.cpp:173 173 signaler.cpp: No such file or directory. (gdb) up #2 0x00007f16f66ec81f in zmq::mailbox_t::recv (this=this@entry=0x7f16f1dfae98, cmd_=cmd_@entry=0x7ffd937625a0, timeout_=timeout_@entry=-1) at mailbox.cpp:72 72 mailbox.cpp: No such file or directory. (gdb) up #3 0x00007f16f66e3e2c in zmq::ctx_t::terminate (this=0x7f16f1dfae00) at ctx.cpp:142 142 ctx.cpp: No such file or directory. (gdb) p this $1 = {tag = 2880293630, sockets = {items = {<std::_Vector_base<zmq::socket_base_t, std::allocatorzmq::socket_base_t* >> = { _M_impl = {<std::allocatorzmq::socket_base_t*> = {<__gnu_cxx::new_allocatorzmq::socket_base_t*> = {}, }, _M_start = 0x7f168683e0b0, _M_finish = 0x7f168683e0b8, _M_end_of_storage = 0x7f168683e0b8}}, }}, empty_slots = {<std::_Vector_base<unsigned int, std::allocator >> = { _M_impl = {<std::allocator> = {<__gnu_cxx::new_allocator> = {}, }, _M_start = 0x7f1686886000, _M_finish = 0x7f1686886ff8, _M_end_of_storage = 0x7f1686887000}}, }, starting = false, terminating = true, slot_sync = {mutex = {__data = { __lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, reaper = 0x7f1686831720, io_threads = {<std::_Vector_base<zmq::io_thread_t*, std::allocatorzmq::io_thread_t* >> = { _M_impl = {<std::allocatorzmq::io_thread_t*> = {<__gnu_cxx::new_allocatorzmq::io_thread_t*> = {}, }, _M_start = 0x7f168683e0a0, _M_finish = 0x7f168683e0a8, _M_end_of_storage = 0x7f168683e0a8}}, }, slot_count = 1026, slots = 0x7f168683f000, term_mailbox = {cpipe = {<zmq::ypipe_base_t<zmq::command_t, 16>> = {_vptr.ypipe_base_t = 0x7f16f691fe10 <vtable for zmq::ypipe_t<zmq::command_t, 16>+16>}, queue = { begin_chunk = 0x7f16f1c65e00, begin_pos = 0, back_chunk = 0x7f16f1c65e00, back_pos = 0, end_chunk = 0x7f16f1c65e00, end_pos = 1, spare_chunk = {ptr = 0x0}}, w = 0x7f16f1c65e00, r = 0x7f16f1c65e00, f = 0x7f16f1c65e00, c = {ptr = 0x0}}, signaler = {w = 27, r = 27, pid = 2151812}, sync = {mutex = {__data = { __lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, active = false}, endpoints = {_M_t = { _M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::endpoint_t> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::endpoint_t> > >> = {}, }, _M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits, std::allocator >, std::basic_string<char, std::char_traits, std::allocator >, bool>> = {}, }, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7f16f1dfaf40, _M_right = 0x7f16f1dfaf40}, _M_node_count = 0}}}, pending_connections = {_M_t = { _M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::pending_connection_t> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::pending_connection_t> > >> = {}, }, _M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits, std::allocator >, std::basic_string<char, std::char_traits, std::allocator >, bool>> = {}, }, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7f16f1dfaf70, _M_right = 0x7f16f1dfaf70}, _M_node_count = 0}}}, endpoints_sync = {mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, static max_socket_id = {value = 5}, max_sockets = 1023, io_thread_count = 1, ipv6 = false, opt_sync = {mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, pid = 2151812}
i don't know why zmq_ctx_term is blocked, i set zmq linger to 2, plsease help me! thank you
The text was updated successfully, but these errors were encountered:
libzmq v3 is no longer supported
Sorry, something went wrong.
No branches or pull requests
Please use this template for reporting suspected bugs or requests for help.
Issue description
problem: code was written in 2018-07-04, until 2020-05-13, eveny thing is fine. 2020-05-13, process stopped by systemd, but was hang in zmq_ctx_term
zmq socket create source code:
void* s = NULL;
int r = 0;
int linger = 2;
int ipv6_support = 0;
char end_point[END_POINT];
I set zmq linger to 2, not 0
GDB bt:
(gdb) info thread
Id Target Id Frame
18 Thread 0x7f16f13d3700 (LWP 2153208) "log" 0x00007f16f3b25995 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
17 Thread 0x7f16ef3ff700 (LWP 2153225) "io-worker-0" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
16 Thread 0x7f16eebfe700 (LWP 2153226) "io-worker-1" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
15 Thread 0x7f16edbff700 (LWP 2153229) "io-worker-2" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
14 Thread 0x7f16ec7ff700 (LWP 2153232) "hb-worker-0" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
13 Thread 0x7f16eaffe700 (LWP 2153266) "service" 0x00007f16f3b25d42 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
12 Thread 0x7f16ea7fd700 (LWP 2153267) "admin_socket" 0x00007f16f2c06f0d in poll () from /lib64/libc.so.6
11 Thread 0x7f16e91f4700 (LWP 2154163) "ceph-osd" 0x00007f16f5a11644 in io_getevents_0_4 () from /opt/h3c/lib/libaio.so.1
10 Thread 0x7f16e89f3700 (LWP 2154164) "ceph-osd" 0x00007f16f3b27afb in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0
9 Thread 0x7f16da3fe700 (LWP 2154259) "ceph-osd" 0x00007f16f3b27afb in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0
8 Thread 0x7f16f6d14e80 (LWP 2155828) "ceph-osd" 0x00007f16f4f6fe67 in timer_helper_thread () from /lib64/librt.so.1
7 Thread 0x7f16857ff700 (LWP 2191105) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
6 Thread 0x7f168b7ff700 (LWP 2191106) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
5 Thread 0x7f1684ffe700 (LWP 2191110) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
4 Thread 0x7f16833fe700 (LWP 2191113) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
3 Thread 0x7f1683bff700 (LWP 2350307) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
2 Thread 0x7f167fffe700 (LWP 2350308) "safe_timer" 0x00007f16f2c12183 in epoll_wait () from /lib64/libc.so.6
1 Thread 0x7f16f6d38e80 (LWP 2151812) "ceph-osd" 0x00007f16f2c06f0d in poll () from /lib64/libc.so.6
(gdb) list
1 req_adapter.c: No such file or directory.
(gdb) bt
#0 0x00007f16f2c06f0d in poll () from /lib64/libc.so.6
#1 0x00007f16f66fa8ba in zmq::signaler_t::wait (this=this@entry=0x7f16f1dfaef8, timeout=timeout@entry=-1) at signaler.cpp:173
#2 0x00007f16f66ec81f in zmq::mailbox_t::recv (this=this@entry=0x7f16f1dfae98, cmd_=cmd_@entry=0x7ffd937625a0, timeout_=timeout_@entry=-1) at mailbox.cpp:72
#3 0x00007f16f66e3e2c in zmq::ctx_t::terminate (this=0x7f16f1dfae00) at ctx.cpp:142
#4 0x00007f16f6927ef1 in destroy_zmq_ctx () from /opt/h3c/lib/libalarm.so
#5 0x00005575f9271367 in main ()
(gdb) down
Bottom (innermost) frame selected; you cannot go down.
(gdb) up
#1 0x00007f16f66fa8ba in zmq::signaler_t::wait (this=this@entry=0x7f16f1dfaef8, timeout_=timeout_@entry=-1) at signaler.cpp:173
173 signaler.cpp: No such file or directory.
(gdb) up
#2 0x00007f16f66ec81f in zmq::mailbox_t::recv (this=this@entry=0x7f16f1dfae98, cmd_=cmd_@entry=0x7ffd937625a0, timeout_=timeout_@entry=-1) at mailbox.cpp:72
72 mailbox.cpp: No such file or directory.
(gdb) up
#3 0x00007f16f66e3e2c in zmq::ctx_t::terminate (this=0x7f16f1dfae00) at ctx.cpp:142
142 ctx.cpp: No such file or directory.
(gdb) p this
$1 = {tag = 2880293630, sockets = {items = {<std::_Vector_base<zmq::socket_base_t, std::allocatorzmq::socket_base_t* >> = {
_M_impl = {<std::allocatorzmq::socket_base_t*> = {<__gnu_cxx::new_allocatorzmq::socket_base_t*> = {}, },
_M_start = 0x7f168683e0b0, _M_finish = 0x7f168683e0b8, _M_end_of_storage = 0x7f168683e0b8}}, }},
empty_slots = {<std::_Vector_base<unsigned int, std::allocator >> = {
_M_impl = {<std::allocator> = {<__gnu_cxx::new_allocator> = {}, }, _M_start = 0x7f1686886000,
_M_finish = 0x7f1686886ff8, _M_end_of_storage = 0x7f1686887000}}, }, starting = false, terminating = true, slot_sync = {mutex = {__data = {
__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}},
__size = '\000' <repeats 39 times>, __align = 0}}, reaper = 0x7f1686831720,
io_threads = {<std::_Vector_base<zmq::io_thread_t*, std::allocatorzmq::io_thread_t* >> = {
_M_impl = {<std::allocatorzmq::io_thread_t*> = {<__gnu_cxx::new_allocatorzmq::io_thread_t*> = {}, },
_M_start = 0x7f168683e0a0, _M_finish = 0x7f168683e0a8, _M_end_of_storage = 0x7f168683e0a8}}, }, slot_count = 1026, slots = 0x7f168683f000,
term_mailbox = {cpipe = {<zmq::ypipe_base_t<zmq::command_t, 16>> = {_vptr.ypipe_base_t = 0x7f16f691fe10 <vtable for zmq::ypipe_t<zmq::command_t, 16>+16>}, queue = {
begin_chunk = 0x7f16f1c65e00, begin_pos = 0, back_chunk = 0x7f16f1c65e00, back_pos = 0, end_chunk = 0x7f16f1c65e00, end_pos = 1, spare_chunk = {ptr = 0x0}},
w = 0x7f16f1c65e00, r = 0x7f16f1c65e00, f = 0x7f16f1c65e00, c = {ptr = 0x0}}, signaler = {w = 27, r = 27, pid = 2151812}, sync = {mutex = {__data = {
__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}},
__size = '\000' <repeats 39 times>, __align = 0}}, active = false}, endpoints = {_M_t = {
_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::endpoint_t> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::endpoint_t> > >> = {}, },
_M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits, std::allocator >, std::basic_string<char, std::char_traits, std::allocator >, bool>> = {}, }, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7f16f1dfaf40,
_M_right = 0x7f16f1dfaf40}, _M_node_count = 0}}}, pending_connections = {_M_t = {
_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::pending_connection_t> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, zmq::pending_connection_t> > >> = {}, },
_M_key_compare = {<std::binary_function<std::basic_string<char, std::char_traits, std::allocator >, std::basic_string<char, std::char_traits, std::allocator >, bool>> = {}, }, _M_header = {_M_color = std::_S_red, _M_parent = 0x0, _M_left = 0x7f16f1dfaf70,
_M_right = 0x7f16f1dfaf70}, _M_node_count = 0}}}, endpoints_sync = {mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0,
__spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, static max_socket_id = {value = 5},
max_sockets = 1023, io_thread_count = 1, ipv6 = false, opt_sync = {mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0,
__elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, pid = 2151812}
Environment
i don't know why zmq_ctx_term is blocked, i set zmq linger to 2, plsease help me! thank you
The text was updated successfully, but these errors were encountered: