-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Why Assertion `event_.ev_base != nullptr' failed? #272
Comments
Seems like same issue as: facebook/folly#601 |
Hi, I also ran into this problem recently. I am wondering if this problem has been resolved now. If not, what should we do with it? |
Hi, use the work-around I wrote here: facebook/folly#601 (comment) |
Thanks, libevent was mixed and the problem has been resolved now. |
please help, when I run a demo, it always print these information, why?
proxygen_server: /work/code/proxygen-2019.07.01.00/proxygen/folly/folly/io/async/EventHandler.cpp:43: bool folly::EventHandler::registerImpl(uint16_t, bool): Assertion
event_.ev_base != nullptr' failed.*** Aborted at 1562667593 (unix time) try "date -d @1562667593" if you are using GNU date ***
PC: @ 0x0 (unknown)
*** SIGABRT (@0x3e900000759) received by PID 1881 (TID 0x7fca99213700) from PID 1881; stack trace: ***
@ 0x7fca9c880390 (unknown)
@ 0x7fca9c4da428 gsignal
@ 0x7fca9c4dc02a abort
@ 0x7fca9c4d2bd7 (unknown)
@ 0x7fca9c4d2c82 __assert_fail
@ 0x7fca9e24bf4b folly::EventHandler::registerImpl()
@ 0x7fca9e23a927 folly::EventHandler::registerInternalHandler()
@ 0x7fca9e23c5c6 folly::NotificationQueue<>::Consumer::startConsumingInternal()
@ 0x7fca9e23809e folly::EventBase::initNotificationQueue()
@ 0x7fca9e233296 folly::EventBase::EventBase()
@ 0x7fca9e1bff27 folly::EventBase::EventBase()
@ 0x7fca9e24909a folly::EventBaseManager::EventBaseInfo::EventBaseInfo()
@ 0x7fca9e248e3d folly::EventBaseManager::getEventBase()
@ 0x7fca9e9d1cd1 proxygen::HTTPServer::start()
@ 0x431190 _ZZ4mainENKUlvE_clEv
@ 0x4329b2 _ZNSt12_Bind_simpleIFZ4mainEUlvE_vEE9_M_invokeIJEEEvSt12_Index_tupleIJXspT_EEE
@ 0x432908 _ZNSt12_Bind_simpleIFZ4mainEUlvE_vEEclEv
@ 0x432898 _ZNSt6thread5_ImplISt12_Bind_simpleIFZ4mainEUlvE_vEEE6_M_runEv
@ 0x7fca9cd5ac80 (unknown)
@ 0x7fca9c8766ba start_thread
@ 0x7fca9c5ac41d clone
@ 0x0 (unknown)
`
`
/*
*/
#include <gflags/gflags.h>
#include <folly/Memory.h>
#include <folly/init/Init.h>
#include <folly/Portability.h>
#include <folly/io/async/EventBaseManager.h>
#include <proxygen/httpserver/HTTPServer.h>
#include <proxygen/httpserver/RequestHandlerFactory.h>
#include <unistd.h>
#include "DemoHandler.h"
using namespace DemoService;
using namespace proxygen;
using folly::EventBase;
using folly::EventBaseManager;
using folly::SocketAddress;
using Protocol = HTTPServer::Protocol;
DEFINE_int32(http_port, 10086, "Port to listen on with HTTP protocol");
DEFINE_string(ip, "localhost", "IP/Hostname to bind to");
DEFINE_int32(threads, 10, "Number of threads to listen on. Numbers <= 0 "
"will use the number of cores on this machine.");
class DemoHandlerFactory : public RequestHandlerFactory {
public:
void onServerStart(folly::EventBase* evb) noexcept override {
printf("on server start\n");
}
void onServerStop() noexcept override {
}
RequestHandler* onRequest(RequestHandler* handler, HTTPMessage* msg) noexcept override {
printf("%s\n", msg->getURL().c_str() );
return new DemoHandler();
}
private:
};
int main(int argc, char* argv[]) {
folly::init(&argc, &argv, true);
std::vectorHTTPServer::IPConfig IPs = {
{SocketAddress(FLAGS_ip, FLAGS_http_port, true), Protocol::HTTP},
};
if (FLAGS_threads <= 0) {
FLAGS_threads = sysconf(_SC_NPROCESSORS_ONLN);
CHECK(FLAGS_threads > 0);
}
HTTPServerOptions options;
options.threads = static_cast<size_t>(FLAGS_threads);
options.idleTimeout = std::chrono::milliseconds(60000);
options.shutdownOn = {SIGINT, SIGTERM};
options.enableContentCompression = true;
options.handlerFactories = RequestHandlerChain()
.addThen()
.build();
HTTPServer server(std::move(options));
server.bind(IPs);
// Start HTTPServer mainloop in a separate thread
std::thread t([&] () {
server.start();
});
t.join();
return 0;
}
`
The text was updated successfully, but these errors were encountered: