Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling Mordor::BaseRequestBroker::request with a bodyDg provided from a native thread segfaults #14

Open
jtolio opened this issue Jul 7, 2012 · 3 comments

Comments

@jtolio
Copy link

jtolio commented Jul 7, 2012

request() assumes it is being called from a fiber, which is not necessarily the case.

    Future<> future;
    boost::exception_ptr exception;
    bool exceptionWasHttp = false;
    if (bodyDg)
        Scheduler::getThis()->schedule(boost::bind(&doBody,
            request, bodyDg, boost::ref(future), boost::ref(exception),
            boost::ref(exceptionWasHttp)));

the last line segfaults, since getThis() returns NULL

@ccutrer
Copy link
Owner

ccutrer commented Jul 7, 2012

Are you ok with non-simultaneous reading and writing of the request
and response? In practice this means a server that sends an error
response and then hangs up before reading the full request would cause
your client to only receive the write error, and not the actual
response.

On Jul 6, 2012, at 6:40 PM, JT
[email protected]
wrote:

request() assumes it is being called from a fiber, which is not necessarily the case.

   Future<> future;
   boost::exception_ptr exception;
   bool exceptionWasHttp = false;
   if (bodyDg)
       Scheduler::getThis()->schedule(boost::bind(&doBody,
           request, bodyDg, boost::ref(future), boost::ref(exception),
           boost::ref(exceptionWasHttp)));

the last line segfaults, since getThis() returns NULL


Reply to this email directly or view it on GitHub:
#14

@jtolio
Copy link
Author

jtolio commented Jul 7, 2012

That sounds like an appropriate tradeoff. That's obviously lighter weight than doing something like spinning up a throwaway thread for doing them synchronously and covers almost all of the use cases. If you want something else set up a scheduler.

Yeah I'm cool with that.

@jtolio
Copy link
Author

jtolio commented Jul 8, 2012

hmm, how hard would it be to get the network/http library tests running both with a scheduler and with no scheduler? i fixed this issue only to find a few more places where an iomanager is assumed (Socket::cancelIo for example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants