Code Monkey home page Code Monkey logo

Comments (3)

alandau avatar alandau commented on May 22, 2024

Out of order is on by default for a cpp2 client + cpp2 server, you don't have to do anything to enable it. There are examples in unittests, e.g. https://github.com/facebook/fbthrift/blob/master/thrift/lib/cpp2/test/ThriftServerTest.cpp
THeaderProtocolFactory and THeaderTransportFactory are cpp1 classes, you don't need to use them. Perhaps the crashes are exactly because of this.

from fbthrift.

varunsharmagit avatar varunsharmagit commented on May 22, 2024

Thanks for the clarification. I removed those instantiations as you mentioned. In my client, I also made sure that all the TAsyncSocket operations including init are happening in the event base thread which is separate from the main thread. My ThriftServer initialization looks like the following. Note that there is a "handler" variable which belongs to a handler implementing the "Ping" call which echoes back the string:

unique_ptr handler(new PingHandler);
shared_ptrapache::thrift::ThriftServer server(new
apache::thrift::ThriftServer);
cout << "Server created..";
handler->setServer(server.get());
server->setInterface(unique_ptr(handler.release()));
server->setPort(port);
cout << "Serving at port " << port << endl;
server->serve();

Now, when I run the client against this server in async mode using a single connection - I get "Channel is !good" and the requestError() function in my RequestCallback is being invoked. The socket is getting created which means that the connection is going through. Is there something else I am missing - the example you gave contains some things around building/passing a ThreadManager but I thought that wont be necessary and that we would use one EventBase for accepting and Cpp2Workers (as many as cores) for running the calls in an event driven fashion. Any help would be really appreciated..

from fbthrift.

varunsharmagit avatar varunsharmagit commented on May 22, 2024

Seems like there was another issue - I tested the duplex pipeline with multiple threads and it works ! Thanks !

from fbthrift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.