Hey Bjorn,

2011/4/4 Bjørn Forsman <[email protected]>:
> First, the error:
>
> # hello.wt --docroot . --http-address 0.0.0.0 --http-port 8080
> Reading: /etc/wt/wt_config.xml
> [1999-Dec-31 17:29:41.389758] 1129 - [notice] "Wt: initializing built-in 
> httpd"
> [1999-Dec-31 17:29:41.395503] 1129 - [notice] "Reading Wt config file:
> /etc/wt/wt_config.xml (location = 'hello.wt')"
> [1999-Dec-31 17:29:41.422544] 1129 - [notice] "Started server:
> http://0.0.0.0:8080";
> remote_endpoint() threw: Bad file descriptor
> terminate called after throwing an instance of
> 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error>'
>  what():  Bad file descriptor

> The code that throws the exceptions is located in <wt>/src/http/Connection.C:
>
> 50 void Connection::start()
> 51 {
> 52   request_parser_.reset();
> 53   request_.reset();
> 54   try {
> 55     request_.remoteIP = socket().remote_endpoint().address().to_string();
> 56   } catch (std::exception& e) {
> 57     std::cerr << "remote_endpoint() threw: " << e.what() << std::endl;
> 58   }
> 59
> 60   socket().set_option(asio::ip::tcp::no_delay(true));
> 61
> 62   startAsyncReadRequest(buffer_, CONNECTION_TIMEOUT);
> 63 }
>
> Both line 55 and 60 throw exceptions (Bad file descriptor), but the
> last exception is uncaught and kills the program.
>
> I did 'call socket()' in gdb (when in the code above). Amongst the
> returned data I found:
>
>  implementation =
> {<boost::asio::detail::reactive_socket_service_base::base_implementation_type>
> = {socket_ = -1, state_ = 0 '\000', reactor_data_ = 0x20202020},
> protocol_ = {

Thanks for trying to find the culprit here. That seems indeed like the
path to failure. The socket itself is created in:

Server::startAccept() and Server::handleTcpAccept()

There, one would expect that if the server indicates that a new
connection was accepted without error (which is checked), the socket
should be valid. Perhaps you can break there to look at the socket. It
would be interesting to see why this is not the case and how the
server example does this differently, assuming it also using
async_accept ? (this is actually code that is inherited from the
original http server example in boost::asio).

Regards,
koen

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to