New issue
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
when server is trying to respond with multiple threads, server is crashing #395
Comments
I tried to enable multithreading via setting num_threads(2) but tried to print how many threads are accessing the handle callback, i don't see two threads are getting created, I have updated my example to include this change, how do i enable multithreading with this library ? |
num_threads sets the number of worker threads, and each thread has its own event loop. |
It seems io_service.post do the job without using strand explicitly. |
Thanks, I will try it out |
I have updated my code. This seems to be working. Thanks. |
I want to create a server which routes the request to the worker threads, which will do the work, once the work is done, it responds back to the client. This is not working with the libnghttp2_asio library. it is crashing.
Core trace is as below:
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./worker'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 stream_weight_less (lhsx=0x7f6f8401c5f0, rhsx=0x0) at nghttp2_stream.c:39
39 return lhs->cycle < rhs->cycle;
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
(gdb) bt
#0 stream_weight_less (lhsx=0x7f6f8401c5f0, rhsx=0x0) at nghttp2_stream.c:39
#1 0x00007f6f91952596 in bubble_up (pq=pq@entry=0x7f6f84000dd8, index=1)
#2 0x00007f6f919526b5 in nghttp2_pq_push (pq=pq@entry=0x7f6f84000dd8,
#3 0x00007f6f91954914 in stream_obq_push (dep_stream=0x7f6f84000dc0,
#4 0x00007f6f91954cba in stream_update_dep_on_attach_item (stream=0x7f6f8401c5e0)
#5 nghttp2_stream_attach_item (stream=0x7f6f8401c5e0,
#6 0x00007f6f919564ac in nghttp2_session_add_item (
#7 0x00007f6f9195ce0d in submit_headers_shared (attach_stream=,
#8 submit_headers_shared_nva (session=0x7f6f84000da0, flags=,
#9 0x00007f6f9195d4bc in nghttp2_submit_response (session=,
#10 0x00007f6f92f0f976 in nghttp2::asio_http2::server::http2_handler::start_response
#11 0x00007f6f92f1201f in nghttp2::asio_http2::server::response_impl::start_response
#12 0x00007f6f92f1234f in nghttp2::asio_http2::server::response_impl::write_head (
#13 0x00007f6f92f11ca6 in nghttp2::asio_http2::server::response::write_head (
#14 0x00000000004090f6 in std::__deque_buf_size (__size=18656976)
#15 0x00000000004091f6 in Worker::dowork (this=0x7f6f8dc37da8, res=...)
#16 0x000000000040f4bf in std::__get_helper<0ul, std::_Mem_fn<void (Worker::)()>, Worker> (__t=...) at /usr/include/c++/4.8/tuple:745
#17 0x000000000040f40f in boost::exception_detail::clone_implboost::exception_detail::error_info_injector<boost::system::system_error >::clone_impl (this=0x11caf40,
#18 0x000000000040f263 in std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (Worker::)()> (Worker)> >::_M_run() (this=0x0) at /usr/include/c++/4.8/thread:115
#19 0x000000000040f128 in std::_Sp_counted_ptr_inplace<std::thread::_Impl<std::_Bind_s---Type to continue, or q to quit---q
Quit
The code for my example resides @
https://github.com/rameshrajagopal/nghttp2_asio_example
I would like to know, is there any problem with the usage of library in my code or is it a known problem on library side ?
Regards,
Ramesh
The text was updated successfully, but these errors were encountered: