[ 
https://issues.apache.org/jira/browse/THRIFT-5611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17580115#comment-17580115
 ] 

Erik edited comment on THRIFT-5611 at 8/16/22 7:43 AM:
-------------------------------------------------------

here's the server side function
{code:java}
void request_matching_symbols(std::vector<MatchingSymbolResponse> & _return, 
const std::vector<std::string> & queries_list) {
    std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() queries_list.size() == " << queries_list.size() << 
std::endl;

    int batch_size = calculate_batch_size(queries_list.size(), 
this->tws_conn_pool->size());
    int remainder  = calculate_remainder(queries_list.size(), 
this->tws_conn_pool->size());

    if (batch_size == 1) {
      std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() Queries list is less than # of clients\n";
      std::future<std::vector<twsapithrift::IBContractDescription>> 
single_future_result;
      SymbolsDataFetcher single_fetcher = 
SymbolsDataFetcher(*this->tws_conn_pool);
      single_future_result = std::async(std::launch::async, 
&SymbolsDataFetcher::process_data, single_fetcher, std::ref(queries_list), 0, 
queries_list.size());

      std::string concetenated_query;
      for (unsigned int i = 0; i < queries_list.size(); i++) {
        concetenated_query += queries_list[i] + ", ";
      }

      MatchingSymbolResponse response_obj;
      response_obj.request_query = concetenated_query;
      response_obj.matches;
      
      std::vector<twsapithrift::IBContractDescription> result_obj = 
single_future_result.get();
      for (unsigned int j = 0; j < result_obj.size(); j++) {
        std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() PUSHING RESULT INTO RESPONSE\n";
        response_obj.matches.push_back(result_obj[j]);
      }
      _return.push_back(response_obj);
      std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() Setting response_obj\n";
      return;
    } {code}


You can see in my ouput I am indeed reaching the return statement but something 
in the client or server is not happy


{code:java}
[hndlr-1] request_matching_symbols() PUSHING RESULT INTO RESPONSE
[hndlr-1] request_matching_symbols() PUSHING RESULT INTO RESPONSE
[hndlr-1] request_matching_symbols() PUSHING RESULT INTO RESPONSE
[hndlr-1] request_matching_symbols() PUSHING RESULT INTO RESPONSE
[hndlr-1] request_matching_symbols() PUSHING RESULT INTO RESPONSE
[hndlr-1] request_matching_symbols() Setting response_obj
Thrift: Tue Aug 16 09:42:29 2022 TSocket::write_partial() send() <Host: 
127.0.0.1 Port: 42128>: Broken pipe
Thrift: Tue Aug 16 09:42:29 2022 TConnectedClient died: write() send(): Broken 
pipe
Thrift: Tue Aug 16 09:42:29 2022 TConnectedClient output close failed: Called 
write on non-open socket {code}


was (Author: emcp):
here's the server side function


{code:java}
void request_matching_symbols(std::vector<MatchingSymbolResponse> & _return, 
const std::vector<std::string> & queries_list) {
    std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() queries_list.size() == " << queries_list.size() << 
std::endl;

    int batch_size = calculate_batch_size(queries_list.size(), 
this->tws_conn_pool->size());
    int remainder  = calculate_remainder(queries_list.size(), 
this->tws_conn_pool->size());

    if (batch_size == 1) {
      std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() Queries list is less than # of clients\n";
      std::future<std::vector<twsapithrift::IBContractDescription>> 
single_future_result;
      SymbolsDataFetcher single_fetcher = 
SymbolsDataFetcher(*this->tws_conn_pool);
      single_future_result = std::async(std::launch::async, 
&SymbolsDataFetcher::process_data, single_fetcher, std::ref(queries_list), 0, 
queries_list.size());

      std::string concetenated_query;
      for (unsigned int i = 0; i < queries_list.size(); i++) {
        concetenated_query += queries_list[i] + ", ";
      }

      MatchingSymbolResponse response_obj;
      response_obj.request_query = concetenated_query;
      response_obj.matches;
      
      std::vector<twsapithrift::IBContractDescription> result_obj = 
single_future_result.get();
      for (unsigned int j = 0; j < result_obj.size(); j++) {
        std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() PUSHING RESULT INTO RESPONSE\n";
        response_obj.matches.push_back(result_obj[j]);
      }
      _return.push_back(response_obj);
      std::cout << "[hndlr-" << this->handler_num << "] 
request_matching_symbols() Setting response_obj\n";
      return;
    } {code}

> v0.16.0 C++ servers suddenly giving brokenpipe errors
> -----------------------------------------------------
>
>                 Key: THRIFT-5611
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5611
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.16.0
>            Reporter: Erik
>            Priority: Major
>
> I jumped from v0.15.0 to v0.16.0 .. and trying to track down what could cause 
> this response in my C++ Server
>  
> {code:java}
> Thrift: Mon Aug 15 22:11:54 2022 TSocket::write_partial() send() <Host: 
> 127.0.0.1 Port: 58998>: Broken pipe 
> Thrift: Mon Aug 15 22:11:54 2022 TConnectedClient died: write() send(): 
> Broken pipe 
> Thrift: Mon Aug 15 22:11:54 2022 TConnectedClient output close failed: Called 
> write on non-open socket
> {code}
>  
> my server code is unchanged and was previously okay, I think.. I will keep 
> debugging and trying to ensure it's not me but.. can anyone clue me in on how 
> to repair this ? or what to look for?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to