Classification: UNCLASSIFIED
Caveats: FOUO

I'm really baffled by this. No one has any ideas? Valgrind is showing an issue 
with something not being allocated:

==23321== Memcheck, a memory error detector
==23321== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==23321== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==23321== Command: ./apeface --port 61234 --no-daemon
==23321== 
Thrift: Tue Nov 13 11:05:42 2012 TNonblockingServer: Serving on port 61234, 1 
io threads.
Thrift: Tue Nov 13 11:05:42 2012 TNonblockingServer: using libevent 
2.0.16-stable method epoll
Thrift: Tue Nov 13 11:05:42 2012 TNonblocking: IO thread #0 registered for 
listen.
Thrift: Tue Nov 13 11:05:42 2012 TNonblocking: IO thread #0 registered for 
notify.
Thrift: Tue Nov 13 11:05:42 2012 TNonblockingServer: IO thread #0 entering 
loop...
Thrift: Tue Nov 13 11:05:46 2012 TNonblockingServer: overload condition begun.
==23321== Use of uninitialised value of size 4
==23321==    at 0x44BB233: 
apache::thrift::server::TNonblockingServer::TConnection::init(int, 
apache::thrift::server::TNonblockingIOThread*, sockaddr const*, unsigned int) 
(TNonblockingServer.cpp:1539)
==23321==    by 0x5604B3F: ???
==23321== 
==23321== Invalid read of size 4
==23321==    at 0x44BB233: 
apache::thrift::server::TNonblockingServer::TConnection::init(int, 
apache::thrift::server::TNonblockingIOThread*, sockaddr const*, unsigned int) 
(TNonblockingServer.cpp:1539)
==23321==    by 0x5604B3F: ???
==23321==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==23321== 
==23321== 
==23321== Process terminating with default action of signal 11 (SIGSEGV)
==23321==  Access not within mapped region at address 0x10
==23321==    at 0x44BB233: 
apache::thrift::server::TNonblockingServer::TConnection::init(int, 
apache::thrift::server::TNonblockingIOThread*, sockaddr const*, unsigned int) 
(TNonblockingServer.cpp:1539)
==23321==    by 0x5604B3F: ???
==23321==  If you believe this happened as a result of a stack
==23321==  overflow in your program's main thread (unlikely but
==23321==  possible), you can try to increase the size of the
==23321==  main thread stack using the --main-stacksize= flag.
==23321==  The main thread stack size used in this run was 8388608.
==23321== 
==23321== HEAP SUMMARY:
==23321==     in use at exit: 10,898 bytes in 219 blocks
==23321==   total heap usage: 345 allocs, 126 frees, 15,196 bytes allocated
==23321== 
==23321== LEAK SUMMARY:
==23321==    definitely lost: 0 bytes in 0 blocks
==23321==    indirectly lost: 0 bytes in 0 blocks
==23321==      possibly lost: 3,086 bytes in 51 blocks
==23321==    still reachable: 7,812 bytes in 168 blocks
==23321==         suppressed: 0 bytes in 0 blocks
==23321== Rerun with --leak-check=full to see details of leaked memory
==23321== 
==23321== For counts of detected and suppressed errors, rerun with: -v
==23321== Use --track-origins=yes to see where uninitialised values come from
==23321== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Killed

-----Original Message-----
From: Knick, Scott E CTR USARMY RCERT-EUR (US) 
Sent: Friday, November 09, 2012 3:44 PM
To: 'user@thrift.apache.org'
Subject: TNonblockingServer: overload condition begun (UNCLASSIFIED)

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



Classification: UNCLASSIFIED
Caveats: FOUO


Reply via email to