drogonframework / drogonframework/drogon
Segmentation fault when running hello world test program
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
I have got segmentation fault when running a simple hello world example.
Here is my main code with a simple handler
#include
using namespace drogon;
int main(int argc, char *argv[]){
bool result = app().reusePort();
cout << result << endl;
app().registerHandler(
"/",
[](const HttpRequestPtr &,
std::function &&callback) {
auto resp = HttpResponse::newHttpResponse();
resp->setBody("Hello, World!");
callback(resp);
},
{Get});
app().setThreadNum(1).addListener("127.0.0.1", 6666).run();
}
gdb core dump (selective text)
====================
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/dev/caravan/poc/src/build/attribute_management/attms_rest/attms_rest...done.
[New LWP 47313]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: the debug information found in "/usr/lib/debug//usr/pgsql-11/lib/libpq.so.5.11.debug" does not match "/usr/pgsql-11/lib/libpq.so.5" (CRC mismatch).
Core was generated by `./attms_rest'.
Program terminated with signal SIGBUS, Bus error.
#0 0x00000000004aad9e in drogon::ListenerManager::getListeners() const ()
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-23.el7.x86_64 glibc-2.17-292.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-37.el7_7.2.x86_64 libcom_err-1.42.9-16.el7.x86_64 libcurl-7.29.0-54.el7_7.1.x86_64 libgcc-4.8.5-39.el7.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 libssh2-1.8.0-3.el7.x86_64 libstdc++-4.8.5-39.el7.x86_64 libuuid-2.23.2-61.el7_7.1.x86_64 net-snmp-libs-5.7.2-49.el7_9.1.x86_64 nspr-4.32.0-1.el7_9.x86_64 nss-3.67.0-4.el7_9.x86_64 nss-softokn-freebl-3.67.0-3.el7_9.x86_64 nss-util-3.67.0-1.el7_9.x86_64 openldap-2.4.44-21.el7_6.x86_64 openssl-libs-1.0.2k-19.el7.x86_64 pcre-8.32-17.el7.x86_64 postgresql11-libs-11.7-1PGDG.rhel7.x86_64 zlib-1.2.7-18.el7.x86_64
(gdb) where
#0 0x00000000004aad9e in drogon::ListenerManager::getListeners() const ()
#1 0x000000000045487d in drogon::HttpAppFrameworkImpl::getListeners() const ()
#2 0x000000000044aef2 in drogon::HttpAppFramework::registerHandler&)>&&)> >(const std::string &, &)>&&)> &&, const std::vector > &, const std::string &) (this=0xa41e20 , pathPattern="/", function=...,
filtersAndMethods=std::vector of length 1, capacity 1 = {...}, handlerName="") at /usr/local/include/drogon/HttpAppFramework.h:451
#3 0x000000000044a933 in main (argc=1, argv=0x7ffcc89541c8) at /home/dev/caravan/poc/src/att_management/attms_rest/main.cpp:16
can anyone help me here, what i am doing wrong here. Thanks
Contributor guide
Assessment
This issue has not been assessed yet.