[jira] [Created] (THRIFT-3502) C++ TServerSocket passes small buffer to getsockname

2015-12-22 Thread Jeremy Spiegel (JIRA)
Jeremy Spiegel created THRIFT-3502:
--

 Summary: C++ TServerSocket passes small buffer to getsockname
 Key: THRIFT-3502
 URL: https://issues.apache.org/jira/browse/THRIFT-3502
 Project: Thrift
  Issue Type: Bug
  Components: C++ - Library
 Environment: Microsoft Visual Studio 2015
Reporter: Jeremy Spiegel


TServerSocket::listen is using a struct sockaddr instead of a struct 
sockaddr_storage when calling getsockname. It then fails to get the bound port 
number when the configured port is 0. See the following stackoverflow post:

http://stackoverflow.com/questions/14624427/wsaefault-error-when-use-getsockname-function



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-4507) TWaitableNamedPipeImpl::read race condition can cause hang in ~TWaitableNamedPipeImpl

2018-03-06 Thread Jeremy Spiegel (JIRA)

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

Jeremy Spiegel commented on THRIFT-4507:


I haven't determined what the right fix is yet. I was able to address the 
problem in my project by forcing TNamedPipeServer to use the normal 
TNamedPipeImpl instead of TWaitableNamedPipeImpl. I don't need 
TWaitableNamedPipeImpl since I don't use a select-like loop.

> TWaitableNamedPipeImpl::read race condition can cause hang in 
> ~TWaitableNamedPipeImpl
> -
>
> Key: THRIFT-4507
> URL: https://issues.apache.org/jira/browse/THRIFT-4507
> Project: Thrift
>  Issue Type: Bug
>  Components: C++ - Library
>Affects Versions: 0.11.0
>Reporter: Jeremy Spiegel
>Priority: Major
>
> If the other side of the pipe disconnects in between a call to endAsyncRead 
> and beginAsyncRead, then the beginAsyncRead will throw, but 
> ~TWaitableNamedPipeImpl will hang inside GetOverlappedResult. Here is some 
> test code that reproduces the issue:
> {code}
> std::promise serverStarted, clientStarted, serverReadStarted, 
> clientDestroyed;
> std::thread serverThread([&] {
> auto server = 
> boost::make_shared("pipe-test", 64 * 
> 1024, 1);
> server->listen();
> serverStarted.set_value();
> auto serverConnection = server->accept();
> clientStarted.get_future().wait();
> uint8_t buf[1024];
> serverConnection->read(buf, 1);
> serverReadStarted.set_value();
> clientDestroyed.get_future().wait();
> try {
> serverConnection->read(buf, 1023);
> } catch (const apache::thrift::transport::TTransportException&) {
> }
> });
> serverStarted.get_future().wait();
> {
> auto client = 
> boost::make_shared("pipe-test");
> client->open();
> uint8_t buf[1024]{};
> client->write(buf, 1024);
> clientStarted.set_value();
> serverReadStarted.get_future().wait();
> }
> clientDestroyed.set_value();
> serverThread.join();
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (THRIFT-4507) TWaitableNamedPipeImpl::read race condition can cause hang in ~TWaitableNamedPipeImpl

2018-03-05 Thread Jeremy Spiegel (JIRA)
Jeremy Spiegel created THRIFT-4507:
--

 Summary: TWaitableNamedPipeImpl::read race condition can cause 
hang in ~TWaitableNamedPipeImpl
 Key: THRIFT-4507
 URL: https://issues.apache.org/jira/browse/THRIFT-4507
 Project: Thrift
  Issue Type: Bug
  Components: C++ - Library
Affects Versions: 0.11.0
Reporter: Jeremy Spiegel


If the other side of the pipe disconnects in between a call to endAsyncRead and 
beginAsyncRead, then the beginAsyncRead will throw, but 
~TWaitableNamedPipeImpl will hang inside GetOverlappedResult. Here is some test 
code that reproduces the issue:
{code}
std::promise serverStarted, clientStarted, serverReadStarted, 
clientDestroyed;
std::thread serverThread([&] {
auto server = 
boost::make_shared("pipe-test", 64 * 
1024, 1);
server->listen();
serverStarted.set_value();
auto serverConnection = server->accept();
clientStarted.get_future().wait();
uint8_t buf[1024];
serverConnection->read(buf, 1);
serverReadStarted.set_value();
clientDestroyed.get_future().wait();
try {
serverConnection->read(buf, 1023);
} catch (const apache::thrift::transport::TTransportException&) {
}
});

serverStarted.get_future().wait();

{
auto client = 
boost::make_shared("pipe-test");
client->open();
uint8_t buf[1024]{};
client->write(buf, 1024);
clientStarted.set_value();
serverReadStarted.get_future().wait();
}
clientDestroyed.set_value();
serverThread.join();
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)