I have a non-blocking multi-threaded thrift server written in C++ and a thrift client written in python. Below code snippets briefly shows how the thrift protocol and binding configurations are done in both C++ server and python client.
My problem is that when the python client makes a call to the C++ server via thrift I get an error saying "thrift non-blocking server overload condition" in the C++ server output (i.e. terminal), which have been indicated in the 3rd and 4th snippets below. I am enclosing the stack that is retrieved via GDB backtrace command as well for your information. Can anyone tell me what I am missing here? What do you think could be the possible cause of this error. Is there st wrong in the thrift configuration in python side or C++ side. Please refer to the below snippets. I made a lot of googling but could not find a clue so far. Thanks.
1) Python Client - Thrift Configuration
try:
self.transport = TSocket.TSocket( host , port)
<----- NONBLOCKING --------->
self.transport = TTransport.TFramedTransport(self.transport)
<----- NONBLOCKING --------->
protocol = TBinaryProtocol.TBinaryProtocol(self.transport)
# Instantiate the thrift client
self.client = MyService.Client(protocol)
# Connect to the thrift server
self.transport.open()
print 'Connection established via thrift...\n'
2) C++ server - Thrift configuration
using boost::shared_ptr;
printf(" *** Starting non-block THRIFT! ***\n");
shared_ptr<MyServiceHandler> handler(new MyServiceHandler(this));
shared_ptr<TProcessor> processor(new MyServiceProcessor(handler));
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
shared_ptr<ThreadManager> threadManager=ThreadManager::newSimpleThreadManager(15);
shared_ptr<PosixThreadFactory> threadFactory =
shared_ptr<PosixThreadFactory>(new PosixThreadFactory());
threadManager->threadFactory(threadFactory);
threadManager->start();
ats::TNonblockingServer server(processor,protocolFactory, port, threadManager);
server.serve();
3) Error Output in C++ server
!!!! ERROR BEGIN !!!!
Thrift: Tue Nov 15 17:59:49 2011 **thrift non-blocking server overload condition**
!!!! ERROR IS END !!!!
4) GDB Backtrace Stack
thrift non-blocking server overload condition
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7ad7b70 (LWP 17961)]
0x080bb3a8 in vtable for __cxxabiv1::__si_class_type_info ()
(gdb) bt
#0 0x080bb3a8 in vtable for __cxxabiv1::__si_class_type_info ()
#1 0xb7ec8195 in apache::thrift::server::TConnection::workSocket (this=0x80be4f0)
at src/server/TNonblockingServer.cpp:168
#2 0xb7ecc88d in apache::thrift::server::TConnection::eventHandler (fd=13, v=0x80be4f0)
at src/server/TNonblockingServer.h:915
#3 0xb7ea8e90 in event_base_loop () from /usr/lib/libevent-1.4.so.2
#4 0xb7ec782f in apache::thrift::server::TNonblockingServer::serve (this=0xb7ad7194)
at src/server/TNonblockingServer.cpp:923
#5 0x0807bef5 in MyConfiguration::runNonBlockingServer (this=0xbffff2ec, port=9090)
at /home/configuration/my_configuration.cpp:485
#6 0x0807de19 in MyConfiguration::run (this=0xbffff2ec)
at /home/configuration/my_configuration.cpp:54
#7 0x08078a2a in redirectPthreadRun (m=0xbffff2ec)
at /home/src/common/p_thread_run.cpp:107
#8 0xb7fa0725 in start_thread () from /lib/libpthread.so.0
#9 0xb7ceb1ce in clone () from /lib/libc.so.6