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

Segmentation fault when running demos/tpc_demo.cc #1526

Open
jordan-at-cy opened this issue Mar 4, 2023 · 2 comments
Open

Segmentation fault when running demos/tpc_demo.cc #1526

jordan-at-cy opened this issue Mar 4, 2023 · 2 comments

Comments

@jordan-at-cy
Copy link

jordan-at-cy commented Mar 4, 2023

hi , i have installed seastar, i builded demos/tpc_demo.cc into an executable

`

g++ tcp_demo.cc pkg-config --cflags --libs --static $SEASTAR/build/release/seastar.pc -g -o ./build/tcp_demo

`

after that , i launch that executable , but i got into Segmentation fault

`

changyao23@ubuntu:~/source_code/seastar/demos$ ./build/tcp_demo
Segmentation fault (core dumped)

`

i use gdb to show more information

`

Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/tcp_demo...
(gdb) r
Starting program: /home/changyao23/source_code/seastar/demos/build/tcp_demo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
seastar::noncopyable_function<seastar::future (seastar::net::packet)>::operator=(seastar::noncopyable_function<seastar::future (seastar::net::packet)>&&) (x=..., this=0x108) at /home/changyao23/source_code/seastar/include/seastar/util/noncopyable_function.hh:202
202 this->~noncopyable_function();
(gdb) bt
#0 seastar::noncopyable_function<seastar::future (seastar::net::packet)>::operator=(seastar::noncopyable_function<seastar::future (seastar::net::packet)>&&) (x=..., this=0x108) at /home/changyao23/source_code/seastar/include/seastar/util/noncopyable_function.hh:202
#1 seastar::streamseastar::net::packet::start(seastar::noncopyable_function<seastar::future (seastar::net::packet)>) (next=...,
this=0xc8) at /home/changyao23/source_code/seastar/include/seastar/core/stream.hh:69
#2 seastar::streamseastar::net::packet::listen(seastar::noncopyable_function<seastar::future (seastar::net::packet)>) (next=...,
this=0xc8) at /home/changyao23/source_code/seastar/include/seastar/core/stream.hh:89
#3 seastar::net::device::receive(std::function<seastar::future (seastar::net::packet)>) (this=0x555555847180, next_packet=...)
at /home/changyao23/source_code/seastar/src/net/net.cc:230
#4 0x00005555556c51e6 in seastar::net::interface::interface (this=0x7fffffffc940,
dev=std::shared_ptrseastar::net::device (use count 2, weak count 0) = {...}) at /home/changyao23/source_code/seastar/src/net/net.cc:258
#5 0x00005555555a51a6 in main (ac=1, av=0x7fffffffe148) at tcp_demo.cc:67
(gdb)

`

i am just new to seastar , why this error happend , looking forward to your reply, thanks in advance

@jordan-at-cy
Copy link
Author

jordan-at-cy commented Mar 4, 2023

and, i am using the latest seastar , "git log" returned messages as below

`

726edcc (HEAD -> master, origin/master, origin/HEAD) Fix markdown formatting
eef1d6e Merge 'Minor abort on OOM changes' from Travis Downs
9cbc1fe Merge 'Make io-tester jobs share sched classes' from Pavel Emelyanov

`

@rainhard
Copy link

rainhard commented Nov 28, 2023

the patch works now.
there should be a standard init/cleanup method, but i can't find it.

 #include <seastar/net/tcp.hh>
 #include <seastar/net/native-stack.hh>
 #include <seastar/core/reactor.hh>
+#include <seastar/core/app-template.hh>
+#include <seastar/core/alien.hh>
 #include <fmt/printf.h>
 
 using namespace seastar;
@@ -60,10 +62,20 @@ struct tcp_test {
     }
 };
 
+// see doc/native-stack.md
 int main(int ac, char** av) {
+    // init reactor
+    app_template::seastar_options ssopts;
+    std::unique_ptr<alien::instance> alien(std::make_unique<alien::instance>());
+    std::shared_ptr<smp> smp(std::make_shared<smp>(*alien));
+    smp->configure(ssopts.smp_opts, ssopts.reactor_opts);
+
     native_stack_options opts;
 
     auto vnet = create_virtio_net_device(opts.virtio_opts, opts.lro);
+    // init queue
+    auto qp = vnet->init_local_queue(opts, 0);
+    vnet->set_local_queue(std::move(qp));
     interface netif(std::move(vnet));
     ipv4 inet(&netif);

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

2 participants