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

Ben Craig commented on THRIFT-2069:
-----------------------------------

I have found a couple of issues with this patch, and I'm working on resolving 
them.
1. Connection timeouts use the TimeoutSeconds member in a place where 
milliseconds are expected.  This means the default of 3 seconds is being 
interpreted as 3 milliseconds.

2. Non-overlapped read and write file are much slower than overlapped reads and 
writes, and much slower than loopback socket reads and writes.  The overall 
latency and throughput of the system is still better than loopback sockets, but 
if you have some kind of external synchronization on the reads and writes, then 
you will hit more contention than normal.  I would switch it all to overlapped, 
but...

3. Starting overlapped I/O on one thread, and completing it on another thread 
is dangerous.  If the starting thread exits, then the overlapped i/o request 
completes with ERROR_OPERATION_ABORTED.  Currently, I start up a new read 
request in an "eager" fashion, so that there is always an outstanding read 
request.  I do this so that clients can get a hold of the event object used in 
the overlapped read so they can do a WaitForMultipleObjects call.  If I want to 
support this use case (and I need to for my own projects), then I am stuck in 
the situation where I must start I/O early so that I can get an event object, 
but I can't start I/O early because the hosting thread could exit.
                
> TPipeServer creates overlapped pipes, then uses synchronous I/O on them with 
> TPipe
> ----------------------------------------------------------------------------------
>
>                 Key: THRIFT-2069
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2069
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 1.0
>         Environment: Windows
>            Reporter: Ben Craig
>             Fix For: 1.0
>
>         Attachments: overlapped_pipes.patch
>
>
> The documentation for ReadFile states the following:
> A pointer to an OVERLAPPED structure is required if the hFile parameter was 
> opened with FILE_FLAG_OVERLAPPED, otherwise it can be NULL.
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467%28v=vs.85%29.aspx
> In C++'s TPipeServer, we create a named pipe with FILE_FLAG_OVERLAPPED, then 
> create a TPipe with it.  TPipe then calls ReadFile without an overlapped 
> structure.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to