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

alexandre parenteau commented on THRIFT-1222:
---------------------------------------------

@Roger: Thanks for your input: As mentioned above, I added the client/server 
cpp tests for HTTP/Async/Libevent. I did not implement the complete client test 
(only testVoid and testString, see TestClient.cpp).

The patch previously proposed is also included, and fixes the crash (uncaught 
exception): Please run the server (--server-type=nonblocking --transport=http), 
and from a console:

curl -D /dev/stdout http://localhost:9090/

The output should be:

HTTP/1.1 500 No more data to read.
Date: Tue, 12 Jul 2011 16:27:09 GMT
Content-Length: 0

And now the server does not crash anymore.

Also you can run the new client test (--transport=evhttp) to verify the 
TEvhttpServer server is working.


> Unhandled exception for TEvhttpServer request
> ---------------------------------------------
>
>                 Key: THRIFT-1222
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1222
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.6.1, 0.7
>         Environment: Any
>            Reporter: alexandre parenteau
>              Labels: patch
>             Fix For: 0.7
>
>         Attachments: thrift-1222.patchv0.2.txt
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> When an error occur during a HTTP request, exceptions are not captured before 
> entering back libevent. For example a simple 'curl http://localhost:8080' 
> will trigger a 'not enough data' exception, however no code will actually set 
> the HTTP status (triggering a unhandled exception, and a crash). 
> Here is a proposed change:
> void TEvhttpServer::request(struct evhttp_request* req, void* self) {
>   try {
>     static_cast<TEvhttpServer*>(self)->process(req);
>   } catch(std::exception& e) {
>       evhttp_send_reply(req, HTTP_INTERNAL, e.what(), 0);
>   }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to