You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
After running snapserver on one of my systems for prolonged periods (usually for days) I encounter snapserver segfaulting with the following message in dmesg:
snapserver[12491]: segfault at 0 ip 00007fe9237a7a27 sp 00007fffcd70ab40 error 4 in libc.so.6[7fe92375c000+16a000]
Steps to Reproduce
Run snapcast for some time
Use it as expected
Experience a segfault after some time
Environment details
OS: Gentoo
Snapcast version: 0.26.0, git
Installed from portage tree ("Package")
Logfiles
snapserver does not provide any log message before it crashes. However, I build it with debug symbols and attached a gdb to it. This is the output:
Thread 3"snapserver" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6ef6640 (LWP 16043)]
0x00007ffff77fea27 in _IO_new_fclose (fp=0x0) at iofclose.c:4848 if (fp->_flags & _IO_IS_FILEBUF)
(gdb) bt
#0 0x00007ffff77fea27 in _IO_new_fclose (fp=0x0) at iofclose.c:48#1 0x0000555555636ade in std::_Sp_counted_deleter<_IO_FILE*, int (*)(_IO_FILE*), std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr_base.h:442#2 0x00005555556392ca in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x7fffe81c9d90) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr_base.h:168#3 0x000055555563215b in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr_base.h:702#4 std::__shared_ptr<_IO_FILE, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr_base.h:1154#5 std::shared_ptr<_IO_FILE>::~shared_ptr (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr.h:122#6 execGetOutput (cmd=...) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/common/utils.hpp:86#7 0x0000555555633539 in getArch () at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/common/utils.hpp:193#8 Host::update (this=0x7ffff6ef3f30) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/config.hpp:95#9 Config::getServerStatus (this=this@entry=0x555555936ae0 <Config::instance()::instance_>, streams=...) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/config.cpp:208#10 0x00005555557653a1 in Server::processRequest(std::shared_ptr<jsonrpcpp::Request>, std::function<void (std::shared_ptr<jsonrpcpp::Entity>, std::shared_ptr<jsonrpcpp::Notification>)> const&) const (this=0x555555950410, request=std::shared_ptr<jsonrpcpp::Request> (use count 3, weak count 0) = {...}, on_response=...)
at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/server.cpp:384#11 0x00005555557681b4 in Server::onMessageReceived(std::shared_ptr<ControlSession>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> const&) (this=0x555555950410,
controlSession=std::shared_ptr<ControlSession> (use count 3, weak count 2) = {...}, message=..., response_handler=...) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/server.cpp:662#12 0x000055555564ddab in ControlServer::onMessageReceived(std::shared_ptr<ControlSession>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> const&) (this=this@entry=0x5555559508f0,
session=std::shared_ptr<ControlSession> (empty) = {...}, message="{\"jsonrpc\": \"2.0\", \"method\": \"Server.GetStatus\", \"params\": [], \"id\": 1}", response_handler=...) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/control_server.cpp:81#13 0x00005555556d42e1 in ControlSessionHttp::handle_request<boost::beast::http::basic_string_body<char>, std::allocator<char>, ControlSessionHttp::on_read(boost::beast::error_code, std::size_t)::<lambda(auto:2&&)> > (send=..., req=..., this=0x7fffe82bc950) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/control_session_http.cpp:223#14 ControlSessionHttp::on_read (this=0x7fffe82bc950, ec=..., bytes_transferred=<optimized out>) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/control_session_http.cpp:376#15 0x00005555556d6c08 in operator() (bytes=226, ec=..., __closure=0x7ffff6ef5930) at /usr/src/debug/media-sound/snapcast-0.26.0/snapcast-0.26.0/server/control_session_http.cpp:156#16 boost::beast::async_base<ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)>, boost::asio::any_io_executor, std::allocator<void> >::complete_now<boost::system::error_code&, unsigned long&> (this=0x7ffff6ef5928) at /usr/include/boost/beast/core/async_base.hpp:392#17 boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >::operator() (bytes_transferred=<optimized out>, ec=..., this=<optimized out>) at /usr/include/boost/beast/http/impl/read.hpp:114#18 boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>::complete (args#1=<optimized out>, args#0=..., this=<optimized out>) at /usr/include/boost/asio/impl/compose.hpp:380
#19 boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>::operator()<boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char>, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)> >(boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)> &, boost::beast::error_code, std::size_t) (this=0x7ffff6ef58c8, self=..., ec=..., bytes_transferred=<optimized out>)
at /usr/include/boost/beast/http/impl/read.hpp:307#20 0x00005555556d7818 in boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>::operator()<boost::system::error_code, long unsigned int> (this=0x7ffff6ef58c8) at /usr/include/boost/asio/cancellation_signal.hpp:141
#21 boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>, void(boost::system::error_code, long unsigned int)>::complete (args#1=<optimized out>, args#0=..., this=0x7ffff6ef5860) at /usr/include/boost/asio/impl/compose.hpp:380
#22 boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>::operator()<boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char>, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>, void(boost::system::error_code, long unsigned int)> >(boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>, void(boost::system::error_code, long unsigned int)> &, boost::beast::error_code, std::size_t) (this=0x7ffff6ef5860, self=..., ec=..., bytes_transferred=<optimized out>) at /usr/include/boost/beast/http/impl/read.hpp:251
#23 0x00005555556d86fc in boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>, void(boost::system::error_code, long unsigned int)>::operator()<const boost::system::error_code&, long unsigned int const&> (this=0x7ffff6ef5860) at /usr/include/boost/asio/cancellation_signal.hpp:141
#24 boost::asio::detail::binder2<boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char, std::char_traits<char>, std::allocator<char> >, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>, void(boost::system::error_code, long unsigned int)>, boost::system::error_code, long unsigned int>::operator() (this=0x7ffff6ef5860) at /usr/include/boost/asio/detail/bind_handler.hpp:289
#25 boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::composed_op<boost::beast::http::detail::read_some_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::asio::detail::composed_op<boost::beast::http::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::detail::parser_is_done>, boost::asio::detail::composed_work<void(boost::asio::any_io_executor)>, boost::beast::http::detail::read_msg_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp>, boost::beast::basic_flat_buffer<std::allocator<char> >, true, boost::beast::http::basic_string_body<char>, std::allocator<char>, ControlSessionHttp::start()::<lambda(boost::system::error_code, std::size_t)> >, void(boost::system::error_code, long unsigned int)>, void(boost::system::error_code, long unsigned int)>, boost::system::error_code, long unsigned int> > (
function=...) at /usr/include/boost/asio/handler_invoke_hook.hpp:88
I have the session still opened so let me know if there is anything more you need to debug this further.
The text was updated successfully, but these errors were encountered:
arch = execGetOutput("arch");
if (arch.empty())
arch = execGetOutput("uname -i");
if (arch.empty() || (arch == "unknown"))
arch = execGetOutput("uname -m");
execGetOutput tries to execute the given command and return it's output. If it fails to execute, the command's stdout stream is closed, which seems to be NULL and to cause the crash. Probably the shell command arch is not available on your gentoo installation.
I've added in af3300c a check for NULL to decide if the stream must be closed or not.
Can you please try if the develop branch fixes the bug?
Description
After running snapserver on one of my systems for prolonged periods (usually for days) I encounter
snapserver
segfaulting with the following message in dmesg:snapserver[12491]: segfault at 0 ip 00007fe9237a7a27 sp 00007fffcd70ab40 error 4 in libc.so.6[7fe92375c000+16a000]
Steps to Reproduce
Environment details
Logfiles
snapserver does not provide any log message before it crashes. However, I build it with debug symbols and attached a gdb to it. This is the output:
I have the session still opened so let me know if there is anything more you need to debug this further.
The text was updated successfully, but these errors were encountered: