Classification: UNCLASSIFIED
Caveats: FOUO
Sorry if this has already been asked, but I couldn't find an option for
searching the mailing list archives.
I am using a TNonblockingServer instance in my C++ program. On a different
64-bit Linux system, this worked fine and all of my unit testing passed.
However, a requirement has forced me to make a 32-bit build of the program, so
I did so on a 32-bit Linux system for simplicity's sake. Everything builds
well, the usual output is given from the program, but then when I run my unit
test, it blows up with an error I don't follow and I get a segmentation fault
(the last line is when this occurs):
Thrift: Fri Nov 9 15:40:11 2012 TNonblockingServer: Serving on port 61234, 1
io threads.
Thrift: Fri Nov 9 15:40:11 2012 TNonblockingServer: using libevent
2.0.16-stable method epoll
Thrift: Fri Nov 9 15:40:11 2012 TNonblocking: IO thread #0 registered for
listen.
Thrift: Fri Nov 9 15:40:11 2012 TNonblocking: IO thread #0 registered for
notify.
Thrift: Fri Nov 9 15:40:11 2012 TNonblockingServer: IO thread #0 entering
loop...
Thrift: Fri Nov 9 15:40:37 2012 TNonblockingServer: overload condition begun.
The stack trace shows:
Thread [1] 2814 [core: 0] (Suspended : Signal : SIGSEGV:Segmentation fault)
apache::thrift::server::TNonblockingServer::TConnection::init() at
0x5a2233
apache::thrift::server::TNonblockingServer::createConnection() at
0x5a341f
apache::thrift::server::TNonblockingServer::handleEvent() at 0x5a7770
apache::thrift::server::TNonblockingIOThread::listenHandler() at
0x5aa91c
event_base_loop() at 0x5c2ce9
apache::thrift::server::TNonblockingIOThread::run() at 0x5a4f18
apache::thrift::server::TNonblockingServer::serve() at 0x5a6022
apache::thrift::server::TServer::run() at TServer.h:112 0x8065e06
main() at main.cpp:171 0x8063e80
What is going on? My code that uses the TNonblockingServer is simple enough:
boost::shared_ptr<Remedy> handler(new Remedy());
boost::shared_ptr<thrift::TProcessor> processor(new
Apeface::RemedyProcessor(handler));
boost::shared_ptr<thrift::protocol::TProtocolFactory> protocolFactory(new
thrift::protocol::TBinaryProtocolFactory());
boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager =
thrift::concurrency::ThreadManager::newSimpleThreadManager();
boost::shared_ptr<thrift::concurrency::PosixThreadFactory> threadFactory =
boost::shared_ptr<thrift::concurrency::PosixThreadFactory>(new
thrift::concurrency::PosixThreadFactory());
threadManager->threadFactory(threadFactory);
threadManager->start();
thrift::server::TNonblockingServer server(processor,
protocolFactory,
portNum,
threadManager);
serverPtr = &server;
server.run();
--
Scott Knick
Classification: UNCLASSIFIED
Caveats: FOUO