PhotonLibOS
PhotonLibOS copied to clipboard
simple in examples crashed
OS: CentOS Linux release 7.9.2009 (Core) GCC: 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC) Curl: 7.85.0
I rebuilt the curl source code and make install because it complained the error as below when I built PhotonLibOS (even libcurl-devel was installed). ‘CURLMOPT_MAX_TOTAL_CONNECTIONS’ was not declared in this scope
Core was generated by `./simple'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x000000000040356c in run_socket_server(photon::net::ISocketServer*, photon::fs::IFile*, AlignedAlloc&, photon::std::condition_variable&, photon::std::mutex&, bool&)::{lambda(photon::net::ISocketStream*)#1}::operator()(photon::net::ISocketStream*) const () (gdb) bt #0 0x000000000040356c in run_socket_server(photon::net::ISocketServer*, photon::fs::IFile*, AlignedAlloc&, photon::std::condition_variable&, photon::std::mutex&, bool&)::{lambda(photon::net::ISocketStream*)#1}::operator()(photon::net::ISocketStream*) const () #1 0x00007fe497f61681 in photon::net::KernelSocketServer::handler(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*) () from /test/PhotonLibOS-0.3.1/examples/simple/libphoton.so #2 0x00007fe497f61597 in photon::ThreadContext11<void ()(Delegate<int, photon::net::ISocketStream>, photon::net::ISocketStream*)>::stub(void*) () from /test/PhotonLibOS-0.3.1/examples/simple/libphoton.so #3 0x00007fe497f71cbc in photon::thread_stub() () from /test/PhotonLibOS-0.3.1/examples/simple/libphoton.so #4 0x0000000000000000 in ?? ()
Did you build with debug mode? Because I didn't find the line number.
Or could you try lower gcc version such as devtoolset 7 or 8?
o
I just tried in CentOS 8 with GCC 8.5.0. All the build errors didn't appear. No need to build curl source code. All follow the guide in readme. I copied simple.cpp to the output directory and build simple.cpp with the command: g++ simple.cpp -o simple -L/test/PhotonLibOS-0.3.1/build/output -lphoton -I/test/PhotonLibOS-0.3.1/include
But when I run simple, it crashed again.
[root@d70e633a75f4 output]# ./simple 2022/10/08 17:05:02|INFO |th=00000000023B3FB0|/test/PhotonLibOS-0.3.1/io/epoll.cpp:288|new_epoll_engine:Init event engine: epoll 2022/10/08 17:05:02|INFO |th=00007F7A2400AB00|simple.cpp:167|run_socket_server:Server is listening for port 9527 ... 2022/10/08 17:05:02|INFO |th=00007F7A238032C0|simple.cpp:86|operator():Start to watch message Segmentation fault (core dumped)
[New LWP 1298] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Core was generated by `./simple'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00000000004028b0 in run_socket_server(photon::net::ISocketServer*, photon::fs::IFile*, AlignedAlloc&, photon::std::condition_variable&, photon::std::mutex&, bool&)::{lambda(photon::net::ISocketStream*)#1}::operator()(photon::net::ISocketStream*) const () Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-164.el8.x86_64 keyutils-libs-1.5.10-9.el8.x86_64 krb5-libs-1.18.2-14.el8.x86_64 libaio-0.3.112-1.el8.x86_64 libcom_err-1.45.6-2.el8.x86_64 libcurl-minimal-7.61.1-22.el8.x86_64 libgcc-8.5.0-4.el8_5.x86_64 libnghttp2-1.33.0-3.el8_2.1.x86_64 libselinux-2.9-5.el8.x86_64 libstdc++-8.5.0-4.el8_5.x86_64 openssl-libs-1.1.1k-5.el8_5.x86_64 pcre2-10.32-2.el8.x86_64 zlib-1.2.11-17.el8.x86_64 (gdb) bt #0 0x00000000004028b0 in run_socket_server(photon::net::ISocketServer*, photon::fs::IFile*, AlignedAlloc&, photon::std::condition_variable&, photon::std::mutex&, bool&)::{lambda(photon::net::ISocketStream*)#1}::operator()(photon::net::ISocketStream*) const () #1 0x00007f7a288ef2d1 in photon::net::KernelSocketServer::handler(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*) () from /test/PhotonLibOS-0.3.1/build/output/libphoton.so #2 0x00007f7a288f0336 in photon::ThreadContext11<void ()(Delegate<int, photon::net::ISocketStream>, photon::net::ISocketStream*)>::stub(void*) () from /test/PhotonLibOS-0.3.1/build/output/libphoton.so #3 0x00007f7a2890146c in photon::thread_stub() () from /test/PhotonLibOS-0.3.1/build/output/libphoton.so #4 0x0000000000000000 in ?? ()
https://github.com/alibaba/PhotonLibOS#3-testing
Note the examples are also built from testing
cmake -D BUILD_TESTING=1 -D ENABLE_SASL=1 -D ENABLE_FUSE=1 -D CMAKE_BUILD_TYPE=Debug ..
make -j
This command will build example code
d will build example code
OS: CentOS Linux release 8.4.2105 Kernel: Linux d70e633a75f4 5.10.102.1-microsoft-standard-WSL2 GCC: 8.5.0 20210514 (Red Hat 8.5.0-4) cmake: version 3.20.2
Yes, I built with the commands after installed some dependencies.
It still crashed with different signature as below:
[New LWP 2695]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./simple-example'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000040aa9e in Delegate<int, IOAlloc::RangeSize, void**>::fire (this=0x0, args#0=..., args#1=@0x7f09900fac98: 0x7f09900fac90)
at /test/PhotonLibOS-0.3.1/include/photon/common/callback.h:118
118 return _func ? _func(_obj, args...) : R();
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-164.el8.x86_64 keyutils-libs-1.5.10-9.el8.x86_64 krb5-libs-1.18.2-14.el8.x86_64 libaio-0.3.112-1.el8.x86_64 libcom_err-1.45.6-2.el8.x86_64 libcurl-minimal-7.61.1-22.el8.x86_64 libgcc-8.5.0-4.el8_5.x86_64 libnghttp2-1.33.0-3.el8_2.1.x86_64 libselinux-2.9-5.el8.x86_64 libstdc++-8.5.0-4.el8_5.x86_64 openssl-libs-1.1.1k-5.el8_5.x86_64 pcre2-10.32-2.el8.x86_64 zlib-1.2.11-17.el8.x86_64
(gdb) bt
#0 0x000000000040aa9e in Delegate<int, IOAlloc::RangeSize, void**>::fire (this=0x0, args#0=..., args#1=@0x7f09900fac98: 0x7f09900fac90)
at /test/PhotonLibOS-0.3.1/include/photon/common/callback.h:118
#1 0x000000000040a4fb in Delegate<int, IOAlloc::RangeSize, void**>::operator() (this=0x0, args#0=..., args#1=@0x7f09900fac98: 0x7f09900fac90)
at /test/PhotonLibOS-0.3.1/include/photon/common/callback.h:115
#2 0x0000000000409496 in IOAlloc::alloc (this=0x0, size=1024) at /test/PhotonLibOS-0.3.1/include/photon/common/io-alloc.h:47
#3 0x0000000000406731 in <lambda(photon::net::ISocketStream*)>::operator()(photon::net::ISocketStream *) const (__closure=0x7f09919138e0,
arg=0x1bc3270) at /test/PhotonLibOS-0.3.1/examples/simple/simple.cpp:131
#4 0x00007f09966649ef in Delegate<int, photon::net::ISocketStream*>::fire (this=0x7f09900fb110, args#0=@0x7f09900fb108: 0x1bc3270)
at /test/PhotonLibOS-0.3.1/include/photon/common/callback.h:118
#5 0x00007f0996662b61 in Delegate<int, photon::net::ISocketStream*>::operator() (this=0x7f09900fb110, args#0=@0x7f09900fb108: 0x1bc3270)
at /test/PhotonLibOS-0.3.1/include/photon/common/callback.h:115
#6 0x00007f099665f6b5 in photon::net::KernelSocketServer::handler (m_handler=..., sess=0x1bc3270)
at /test/PhotonLibOS-0.3.1/net/kernel_socket.cpp:444
#7 0x00007f09966663bc in tuple_assistance::apply_impl<void (*&)(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*), std::tuple<Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*>&, 0, 1> (
f=@0x7f09900fb1c0: 0x7f099665f684 <photon::net::KernelSocketServer::handler(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*)>, t=std::tuple containing = {...}) at /test/PhotonLibOS-0.3.1/include/photon/common/tuple-assistance.h:81
#8 0x00007f09966663fd in tuple_assistance::apply<void (*&)(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*), std::tuple<Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*>&> (
f=@0x7f09900fb1c0: 0x7f099665f684 <photon::net::KernelSocketServer::handler(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*)>, t=std::tuple containing = {...}) at /test/PhotonLibOS-0.3.1/include/photon/common/tuple-assistance.h:88
#9 0x00007f0996666462 in photon::ThreadContext11__<void (*)(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*)>::stub11 (
args=0x7f0990905940) at /test/PhotonLibOS-0.3.1/include/photon/thread/thread11.h:58
#10 0x00007f0996665e3f in photon::ThreadContext11<void (*)(Delegate<int, photon::net::ISocketStream*>, photon::net::ISocketStream*)>::stub (
args=0x7f0990905940) at /test/PhotonLibOS-0.3.1/include/photon/thread/thread11.h:76
#11 0x00007f09966961e1 in photon::thread::go (this=0x7f09900fb280) at /test/PhotonLibOS-0.3.1/thread/thread.cpp:142
#12 0x00007f099668fa9b in photon::thread_stub () at /test/PhotonLibOS-0.3.1/thread/thread.cpp:408
#13 0x0000000000000000 in ?? ()
That's very strange. CentOS 8 is a very basic platform to run Photon. Here is my suggestion:
- I provide a temporary cloud server (CentOS 8) for you with public network access, and you log in that to demonstrate the issue.
- You provide one, and I'll login and do the debug
Thanks. It would be great if you can provide one. I have no cloud server yet. I'm running the build in my docker desktop.
email you public key to me?
OK.
Thanks @beef9999
I just verified the build and running on your cloud server. It works well. So the issue must be due to the difference between my container and your cloud server.
OS: CentOS 8.4 vs CentOS 8.5 Kernel: 5.10.102.1-microsoft-standard-WSL2 vs 4.18.0-348.7.1.el8_5.x86_64 GCC: same Cmake: same Docker Desktop vs Alicloud server