Skip to content
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

跑getting-started.cc报段错误 #610

Closed
songziqin opened this issue Feb 20, 2019 · 25 comments
Closed

跑getting-started.cc报段错误 #610

songziqin opened this issue Feb 20, 2019 · 25 comments

Comments

@songziqin
Copy link

Hello world
Segmentation fault on shard 7.
Backtrace:
0x00000000005c24fc
0x00000000005c2620
0x00000000005c2695
/lib/x86_64-linux-gnu/libpthread.so.0+0x000000000001138f
0x00000000006135f3
0x0000000000618ae7
0x0000000000675bdd
/lib/x86_64-linux-gnu/libpthread.so.0+0x00000000000076b9
/lib/x86_64-linux-gnu/libc.so.6+0x000000000010741c
Segmentation fault (core dumped)

@denesb
Copy link
Contributor

denesb commented Feb 20, 2019

Hi @songziqin can you provide more details? Is this the getting started example from the tutorial? How did you compile it?
Also please resolve the backtrace by running:

/path/to/seastar/scripts/seastar-addr2line -e /path/to/your/getting_started_executable 0x00000000005c24fc
0x00000000005c2620
0x00000000005c2695
/lib/x86_64-linux-gnu/libpthread.so.0+0x000000000001138f
0x00000000006135f3
0x0000000000618ae7
0x0000000000675bdd
/lib/x86_64-linux-gnu/libpthread.so.0+0x00000000000076b9
/lib/x86_64-linux-gnu/libc.so.6+0x000000000010741c

@songziqin
Copy link
Author

WARN 2019-02-20 11:49:09,676 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,677 seastar - Seastar compiled with default allocator, heap profiler not supported
WARN 2019-02-20 11:49:09,682 [shard 0] seastar - Unable to set SCHED_FIFO scheduling policy for timer thread; latency impact possible. Try adding CAP_SYS_NICE
Segmentation fault on shard 2.
Backtrace:
0x00000000005994ec
0x0000000000599610
0x0000000000599685
/lib/x86_64-linux-gnu/libpthread.so.0+0x000000000001138f
0x00000000005ea5d3
0x00000000005efab7
0x000000000063b66d
/lib/x86_64-linux-gnu/libpthread.so.0+0x00000000000076b9
/lib/x86_64-linux-gnu/libc.so.6+0x000000000010741c
Segmentation fault (core dumped)
I ran /seastar/build/release/apps/memcached also report the same error. I compiler the seastar through
execute_process(COMMAND bash "build.sh"
WORKING_DIRECTORY ${SEASTAR_ROOT}/service/build_script)

@denesb
Copy link
Contributor

denesb commented Feb 20, 2019

Please resolve the backtraces, we cannot extract any information from them in their raw form. See my previous comment for instructions on how to do it.

@songziqin
Copy link
Author

thanks,@denesb. the report as follows.
root@103-34-105-sh-100-D04:/tmp/x-deeplearning/xdl/third_party/seastar/build/release/apps/httpd# /tmp/x-deeplearning/xdl/third_party/seastar/scripts/seastar-addr2line -e ./httpd 0x00000000005c24fc
std::default_deleteseastar::parallel_for_each_state::operator()(seastar::parallel_for_each_state*) const at /usr/include/c++/5/bits/unique_ptr.h:76
(inlined by) std::unique_ptr<seastar::parallel_for_each_state, std::default_deleteseastar::parallel_for_each_state >::~unique_ptr() at /usr/include/c++/5/bits/unique_ptr.h:236
(inlined by) auto seastar::do_with<seastar::parallel_for_each_state, seastar::future<> seastar::parallel_for_each<boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}>(boost::range_detail::integer_iterator, boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}&&)::{lambda(seastar::parallel_for_each_state&)#1}>(void (&&)(), seastar::future<> seastar::parallel_for_each<boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}>(boost::range_detail::integer_iterator, boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}&&)::{lambda(seastar::parallel_for_each_state&)#1})::{lambda(void (&&)())#1}::~do_with() at /tmp/x-deeplearning/xdl/third_party/seastar/core/do_with.hh:58
(inlined by) seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1} seastar::future<>::then_wrapped<auto seastar::do_with<seastar::parallel_for_each_state, seastar::future<> seastar::parallel_for_each<boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}>(boost::range_detail::integer_iterator, boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}&&)::{lambda(seastar::parallel_for_each_state&)#1}>(void (&&)(), seastar::future<> seastar::parallel_for_each<boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}>(boost::range_detail::integer_iterator, boost::range_detail::integer_iterator, seastar::future<> seastar::smp::invoke_on_all<void ()()>(void (&&)())::{lambda(unsigned int)#1}&&)::{lambda(seastar::parallel_for_each_state&)#1})::{lambda(void (&&)())#1}, seastar::future<> >(void (&&)())::{lambda(void (&&)())#1}::~then_wrapped() at /tmp/x-deeplearning/xdl/third_party/seastar/core/future.hh:939

@nyh
Copy link
Contributor

nyh commented Feb 20, 2019

Please show us exactly the getting-started.cc you compiled, and the command line you used to compile it (what are /service/build_script and build.sh you refered to? and run it). This backtrace (whose order I don't understand, and I'm worried maybe it is using wrong debug information?) suggests the code uses things like parallel_for_each and invoke_all, which the most basic example did not use. So I'm wondering what it is that you compiled.

You can build Seastar with (see README.md)

sudo ./install-dependencies.sh
./configure.py --mode=release
ninja -C build/release

And then build your example application with pkg-config or cmake, as the example in docs/tutorial.md show.

@songziqin
Copy link
Author

thanks @nyh . i give the debug information above is third_party/seastar/build/release/apps/httpd.the sorce code is /seastar/apps/httpd as follows:
/*

  • This file is open source software, licensed to you under the terms
  • of the Apache License, Version 2.0 (the "License"). See the NOTICE file
  • distributed with this work for additional information regarding copyright
  • ownership. You may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  • http://www.apache.org/licenses/LICENSE-2.0
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an
  • "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  • KIND, either express or implied. See the License for the
  • specific language governing permissions and limitations
  • under the License.
    /
    /
  • Copyright 2015 Cloudius Systems
    */

#include "http/httpd.hh"
#include "http/handlers.hh"
#include "http/function_handlers.hh"
#include "http/file_handler.hh"
#include "apps/httpd/demo.json.hh"
#include "http/api_docs.hh"

namespace bpo = boost::program_options;

using namespace seastar;
using namespace httpd;

class handl : public httpd::handler_base {
public:
virtual future<std::unique_ptr > handle(const sstring& path,
std::unique_ptr req, std::unique_ptr rep) {
rep->_content = "hello";
rep->done("html");
return make_ready_future<std::unique_ptr>(std::move(rep));
}
};

void set_routes(routes& r) {
function_handler* h1 = new function_handler([](const_req req) {
return "hello";
});
function_handler* h2 = new function_handler([](std::unique_ptr req) {
return make_ready_futurejson::json_return_type("json-future");
});
r.add(operation_type::GET, url("/"), h1);
r.add(operation_type::GET, url("/jf"), h2);
r.add(operation_type::GET, url("/file").remainder("path"),
new directory_handler("/"));
demo_json::hello_world.set(r, [] (const_req req) {
demo_json::my_object obj;
obj.var1 = req.param.at("var1");
obj.var2 = req.param.at("var2");
demo_json::ns_hello_world::query_enum v = demo_json::ns_hello_world::str2query_enum(req.query_parameters.at("query_enum"));
// This demonstrate enum conversion
obj.enum_var = v;
return obj;
});
}

int main(int ac, char** av) {
app_template app;
app.add_options()("port", bpo::value<uint16_t>()->default_value(10000),
"HTTP Server port");
return app.run_deprecated(ac, av, [&] {
auto&& config = app.configuration();
uint16_t port = config["port"].as<uint16_t>();
auto server = new http_server_control();
auto rb = make_shared<api_registry_builder>("apps/httpd/");
server->start().then([server] {
return server->set_routes(set_routes);
}).then([server, rb]{
return server->set_routes([rb](routes& r){rb->set_api_doc(r);});
}).then([server, rb]{
return server->set_routes([rb](routes& r) {rb->register_function(r, "demo", "hello world application");});
}).then([server, port] {
return server->listen(port);
}).then([server, port] {
std::cout << "Seastar HTTP server listening on port " << port << " ...\n";
engine().at_exit([server] {
return server->stop();
});
});

});

}

@songziqin
Copy link
Author

@nyh
I have follow the instructions to build the seastar. but the step I got the error
CMake Error at /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find GnuTLS: Found unsuitable version "3.3.24", but required is
at least "3.3.26" (found /usr/lib64/libgnutls.so)
Call Stack (most recent call first):
/usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)
cmake/FindGnuTLS.cmake:47 (find_package_handle_standard_args)
CMakeLists.txt:244 (find_package)
I want to know is there the complete instructions to build seastar . my os is centos.

@nyh
Copy link
Contributor

nyh commented Feb 20, 2019

You said you had the same problem with a simpler getting-started.cc from the tutorial, so can we start with that?
The error about the GnuTLS library is self-explanatory - you need to update it. Can you please try "yum update gnutls " and see if it gets updated?

@hakuch (who write this cmake build scripts), do we really need 3.3.26 of GnuTLS and 3.3.24 would not work?

@songziqin
Copy link
Author

@nyh the output is gnutls-3.3.24-1.el7.x86_64 has installed and do nothing.so it does not work
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 gnutls-3.3.24-1.el7.x86_64 已安装并且是最新版本
无须任何处理

@nyh
Copy link
Contributor

nyh commented Feb 20, 2019

According to http://mirror.centos.org/centos/7/os/x86_64/Packages/, there is gnutls-3.3.29-8.el7.i686.rpm for centos 7, I don't know why you're not getting this. Maybe you're stuck on some old subversion of centos 7 (check out "cat /etc/redhat-release")? Note that gnutls 3.3.26 (what Scylla currently requests) is two years old, it's not a very new package.
In any case, it would be nice for Seastar to be more forgiving and not insist on GnuTLS 3.3.26 if it's not really needed. But maybe it is. @hakuch ?

@songziqin
Copy link
Author

thanks.it says CentOS Linux release 7.2.1511 (Core).

@nyh
Copy link
Contributor

nyh commented Feb 20, 2019

Centos 7.2.1511 is from November 2015. That's pretty old and I doubt gnutls will be your only problem compiling Seastar. Maybe you need to "yum update" everything to get a newer release and its associated gnutls?
If you don't want to update your system, another option is to use "cooking", a tool that comes packaged with Seastar and downloads all its prerequisites (including gnuTLS) from source code and compile them (this will take a long time, so be prepared). You can read about it in README.md or HACKING.md.

@songziqin
Copy link
Author

@nyh. Ok , I got the problem, thanks a lot.

@hakuch
Copy link
Contributor

hakuch commented Feb 20, 2019

You said you had the same problem with a simpler getting-started.cc from the tutorial, so can we start with that?
The error about the GnuTLS library is self-explanatory - you need to update it. Can you please try "yum update gnutls " and see if it gets updated?

@hakuch (who write this cmake build scripts), do we really need 3.3.26 of GnuTLS and 3.3.24 would not work?

The minimum required version is just a best guess.

If we test 3.3.24 and it works, then we can lower it.

@nyh
Copy link
Contributor

nyh commented Feb 20, 2019

@hakuch on what was this guess based?
Any reason why we shouldn't err to the other side, i.e., require version 3.3.0, and only if we find out that it doesn't work below 3.3.7 (for example), lower this?

@songziqin you can edit the script that insists on 3.3.26 and modify it to 3.3.24 and see if everything works. But I'm suspecting that if your distro is 3 years old, you'll have a lot of other problems, not just gnutls.

@hakuch
Copy link
Contributor

hakuch commented Feb 20, 2019

@hakuch on what was this guess based?
Any reason why we shouldn't err to the other side, i.e., require version 3.3.0, and only if we find out that it doesn't work below 3.3.7 (for example), lower this?

They were based on the installed versions on Fedora 28, which is a known correct set of values but of course not the minimum ones.

If somebody has a need for a lower version and they have verified that it works, of course we can lower the requirements in CMakeLists.txt and cmake/SeastarConfig.cmake.in.

@songziqin
Copy link
Author

songziqin commented Feb 21, 2019

@denesb @nyh I have a question,I see doc/tutorial.md there is a example:
seastar::future<> f() {
return seastar::parallel_for_each(boost::irange(0, seastar::smp::count),
[] (unsigned c) {
return seastar::smp::submit_to(c, service_loop);
});
}
that can implement each of Seastar cores (from 0 to smp::count-1) to run the same function service_loop(). and the document also says sharded<> can do better. and I want to know how the
sharded<> do the same thing. can you give a simple example.

@songziqin
Copy link
Author

songziqin commented Feb 21, 2019

@denesb @nyh I have update the centos,but run ./configure.py I got the error message:
CMake Error at /tmp/cmake-3.10.2-Linux-x86_64/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find StdFilesystem (missing: StdFilesystem_LIBRARY_NAME)
Call Stack (most recent call first):
/tmp/cmake-3.10.2-Linux-x86_64/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindStdFilesystem.cmake:72 (find_package_handle_standard_args)
CMakeLists.txt:250 (find_package)

what that mean.

@hakuch
Copy link
Contributor

hakuch commented Feb 21, 2019

Seastar requires the filesystem library.

If your compiler supports C++17, then this library should be available via #include <filesystem>. Otherwise, it needs to be available via #include <experimental/filesystem>.

If that check fails during configuration, then you need to use a newer compiler and/or standard library which supports the filesystem library.

@songziqin
Copy link
Author

songziqin commented Feb 21, 2019

@hakuch hi thanks . I have upgrade the gcc compiler but the error messages appears.
[7/206] Building CXX object CMakeFiles/seastar.dir/src/core/dpdk_rte.cc.o
FAILED: CMakeFiles/seastar.dir/src/core/dpdk_rte.cc.o
/usr/local/bin/g++ -DSEASTAR_HAVE_HWLOC -DSEASTAR_HAVE_LZ4_COMPRESS_DEFAULT -DSEASTAR_HAVE_NUMA -I../../include -Igen/include -I../../src -Igen/src -isystem /usr/local/include -isystem _cooking/installed/include -O2 -g -DNDEBUG -std=gnu++17 -U_FORTIFY_SOURCE -fvisibility=hidden -UNDEBUG -Wall -Werror -Wno-error=deprecated-declarations -gz -MD -MT CMakeFiles/seastar.dir/src/core/dpdk_rte.cc.o -MF CMakeFiles/seastar.dir/src/core/dpdk_rte.cc.o.d -o CMakeFiles/seastar.dir/src/core/dpdk_rte.cc.o -c ../../src/core/dpdk_rte.cc
g++: 错误:-gz is not supported in this configuration
my g++ version is g++ (GCC) 5.5.0

@hakuch
Copy link
Contributor

hakuch commented Feb 21, 2019

According to this page, you might be able to use -gz=none.

Like this:

./configure.py --mode=release --cflags='-gz=none'

@songziqin
Copy link
Author

songziqin commented Feb 21, 2019

thanks,@hakuch but it does not help,it report the same error. and I delete those as follows:
if (Seastar_COMPRESS_DEBUG)

-gz doesn't imply -g, so it is safe to add it regardless of debug

info being enabled.

#list (APPEND Seastar_PRIVATE_CXX_FLAGS -gz)
endif()
and it does work.but when i run ninja-build -C build/release the errors appear again as follows:
[22/201] Building CXX object CMakeFiles/seastar.dir/src/core/reactor.cc.o
FAILED: CMakeFiles/seastar.dir/src/core/reactor.cc.o
/usr/local/bin/g++ -DSEASTAR_HAVE_HWLOC -DSEASTAR_HAVE_LZ4_COMPRESS_DEFAULT -DSEASTAR_HAVE_NUMA -I../../include -Igen/include -I../../src -Igen/src -isystem /usr/local/include -isystem _cooking/installed/include -O2 -g -DNDEBUG -std=gnu++17 -U_FORTIFY_SOURCE -fvisibility=hidden -UNDEBUG -Wall -Werror -Wno-error=deprecated-declarations -MD -MT CMakeFiles/seastar.dir/src/core/reactor.cc.o -MF CMakeFiles/seastar.dir/src/core/reactor.cc.o.d -o CMakeFiles/seastar.dir/src/core/reactor.cc.o -c ../../src/core/reactor.cc
../../src/core/reactor.cc: 在函数‘unsigned int seastar::allocate_scheduling_group_id()’中:
../../src/core/reactor.cc:5642:88: 错误:expected ‘,’ before ‘)’ token
static_assert(max_scheduling_groups() <= std::numeric_limits::digits);
^
../../src/core/reactor.cc:5642:88: 错误:expected string-literal before ‘)’ token
In file included from /usr/local/include/c++/5.5.0/x86_64-unknown-linux-gnu/bits/c++allocator.h:33:0,
from /usr/local/include/c++/5.5.0/bits/allocator.h:46,
from /usr/local/include/c++/5.5.0/memory:63,
from ../../include/seastar/core/task.hh:24,
from ../../src/core/reactor.cc:30:

/usr/local/include/c++/5.5.0/ext/new_allocator.h:120:4: 错误:对‘std::pair<const long unsigned int, std::vectorseastar::io_queue* >::pair(const long unsigned int&, long unsigned int)’的调用没有匹配的函数
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^
In file included from /usr/local/include/c++/5.5.0/bits/stl_algobase.h:64:0,
from /usr/local/include/c++/5.5.0/memory:62,
from ../../include/seastar/core/task.hh:24,
from ../../src/core/reactor.cc:30:

I wonder if the compiler is not very new . my gcc version is:5.5.0
[root@103-34-105-sh-100-D04 seastar]# /usr/local/bin/g++ --version
g++ (GCC) 5.5.0
Copyright © 2015 Free Software Foundation, Inc.

@denesb
Copy link
Contributor

denesb commented Feb 22, 2019

Yes, your compiler is quite old. I don't know exactly what is the minimum compiler version we support these days, but gcc 7.x and newer is known to work.

@nyh
Copy link
Contributor

nyh commented Feb 24, 2019

I think the "static_assert(max_scheduling_groups() <= std::numeric_limits::digits)" is actually a Seastar bug - if we claim to support C++14, not just C++17, we can't use the new C++17 static_assert with a single parameter.

@nyh
Copy link
Contributor

nyh commented Sep 9, 2021

Closing this issue. It talks about what by now is a 6 year old distribution, which Seastar doesn't support now (and didn't back when this issue was created), so we can't do much with the information in the issue.

@nyh nyh closed this as completed Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants