[ 
https://issues.apache.org/jira/browse/THRIFT-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Zanin updated THRIFT-2099:
----------------------------------

    Description: 
If client of TThreadPoolServer kept alive connection (for example if requests 
to thrift-server are forwarded from nginx-server, which is set up so that the 
connections between him and thift-server are kept alive), method 
TThreadPoolServer::stop does not stopped server. It continues work until client 
(nginx-server) will not stopped.
{code:java}
void StopThread(shared_ptr<EchoService> const &echo_service_handler,
                                shared_ptr<TThreadPoolServer> &server,
                                shared_ptr<ThreadManager> &thread_manager)
{
        while (echo_service_handler->GetRequestsCount() < 3)
        {
                sleep(1);
        }
        std::cout << "Stop service." << std::endl;
        server->stop();
}
{code}

If immediately after stop of server stop its thread_manager, thrift-server will 
stop correctly.
{code:java}
void StopThread(shared_ptr<EchoService> const &echo_service_handler,
                                shared_ptr<TThreadPoolServer> &server,
                                shared_ptr<ThreadManager> &thread_manager)
{
        while (echo_service_handler->GetRequestsCount() < 3)
        {
                sleep(1);
        }
        std::cout << "Stop service." << std::endl;
        server->stop();
        thread_manager->stop();
}
{code}

If after stop server do some action and then stop its thread_manager, 
thrift-server will not stop.
{code:java}
void StopThread(shared_ptr<EchoService> const &echo_service_handler,
                                shared_ptr<TThreadPoolServer> &server,
                                shared_ptr<ThreadManager> &thread_manager)
{
        while (echo_service_handler->GetRequestsCount() < 3)
        {
                sleep(1);
        }
        std::cout << "Stop service." << std::endl;
        server->stop();
        sleep(1);
        thread_manager->stop();
}
{code}

I think should be possible to stop the thrift-server with alive connections.

  was:
If client of TThreadPoolServer kept alive connection (for example if requests 
to thrift-server are forwarded from nginx-server, which is set up so that the 
connections between him and thift-server are kept alive), method 
TThreadPoolServer::stop does not stopped server. It continues work until client 
(nginx-server) will not stopped.
{code:cpp}
void StopThread(shared_ptr<EchoService> const &echo_service_handler,
                                shared_ptr<TThreadPoolServer> &server,
                                shared_ptr<ThreadManager> &thread_manager)
{
        while (echo_service_handler->GetRequestsCount() < 3)
        {
                sleep(1);
        }
        std::cout << "Stop service." << std::endl;
        server->stop();
}
{code}

If immediately after stop of server stop its thread_manager, thrift-server will 
stop correctly.
{code:cpp}
void StopThread(shared_ptr<EchoService> const &echo_service_handler,
                                shared_ptr<TThreadPoolServer> &server,
                                shared_ptr<ThreadManager> &thread_manager)
{
        while (echo_service_handler->GetRequestsCount() < 3)
        {
                sleep(1);
        }
        std::cout << "Stop service." << std::endl;
        server->stop();
        thread_manager->stop();
}
{code}

If after stop server do some action and then stop its thread_manager, 
thrift-server will not stop.
{code:cpp}
void StopThread(shared_ptr<EchoService> const &echo_service_handler,
                                shared_ptr<TThreadPoolServer> &server,
                                shared_ptr<ThreadManager> &thread_manager)
{
        while (echo_service_handler->GetRequestsCount() < 3)
        {
                sleep(1);
        }
        std::cout << "Stop service." << std::endl;
        server->stop();
        sleep(1);
        thread_manager->stop();
}
{code}

I think should be possible to stop the thrift-server with alive connections.

    
> TThreadPoolServer with alive connections not stopped.
> -----------------------------------------------------
>
>                 Key: THRIFT-2099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2099
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Ubuntu 12.04, Thrift 0.9, Nginx 1.4.1, Python 2.7.3, GCC 
> 4.6.3
>            Reporter: Aleksey Zanin
>
> If client of TThreadPoolServer kept alive connection (for example if requests 
> to thrift-server are forwarded from nginx-server, which is set up so that the 
> connections between him and thift-server are kept alive), method 
> TThreadPoolServer::stop does not stopped server. It continues work until 
> client (nginx-server) will not stopped.
> {code:java}
> void StopThread(shared_ptr<EchoService> const &echo_service_handler,
>                               shared_ptr<TThreadPoolServer> &server,
>                               shared_ptr<ThreadManager> &thread_manager)
> {
>       while (echo_service_handler->GetRequestsCount() < 3)
>       {
>               sleep(1);
>       }
>       std::cout << "Stop service." << std::endl;
>       server->stop();
> }
> {code}
> If immediately after stop of server stop its thread_manager, thrift-server 
> will stop correctly.
> {code:java}
> void StopThread(shared_ptr<EchoService> const &echo_service_handler,
>                               shared_ptr<TThreadPoolServer> &server,
>                               shared_ptr<ThreadManager> &thread_manager)
> {
>       while (echo_service_handler->GetRequestsCount() < 3)
>       {
>               sleep(1);
>       }
>       std::cout << "Stop service." << std::endl;
>       server->stop();
>       thread_manager->stop();
> }
> {code}
> If after stop server do some action and then stop its thread_manager, 
> thrift-server will not stop.
> {code:java}
> void StopThread(shared_ptr<EchoService> const &echo_service_handler,
>                               shared_ptr<TThreadPoolServer> &server,
>                               shared_ptr<ThreadManager> &thread_manager)
> {
>       while (echo_service_handler->GetRequestsCount() < 3)
>       {
>               sleep(1);
>       }
>       std::cout << "Stop service." << std::endl;
>       server->stop();
>       sleep(1);
>       thread_manager->stop();
> }
> {code}
> I think should be possible to stop the thrift-server with alive connections.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to