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

Peace C commented on THRIFT-1690:
---------------------------------

I don't have any objection to moving the anonymous pipe transport to its own 
class. There wouldn't be an anonymous socket though (domain sockets are always 
named). On *NIX, an unnamed pipe can be created and the resulting file R/W 
descriptors passed on to the child process, conceptually similar to Windows' 
handles created from CreatePipe.

Take a look at contrib/transport-sample for cross-platform code that uses pipe 
transport. There are still some #ifdefs in there, many of which can't be 
avoided simply due to general platform differences. A portion of the #ifdefs 
are in the anonymous pipe section which could potentially be abstracted.

Upon reviewing it, I see a few potential things that could be pulled into the 
transport. For instance, there's an unlink called in RunThriftServer in 
ThriftCommon.cpp. It's there in case the same domain socket had been previously 
used. Perhaps that could be placed in the destructor to address the cleanup 
concerns?
                
> Sockets and Pipe Handles truncated on Win64
> -------------------------------------------
>
>                 Key: THRIFT-1690
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1690
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: 64-bit Windows
>            Reporter: Ben Craig
>            Assignee: Roger Meier
>         Attachments: lib_socket_typedef.patch, libthrift_pipe_size.patch, 
> libthrift_warning_purge.patch
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> On 64-bit Windows, "int" is a 32-bit value.  SOCKET and HANDLE are 64-bit.
> All of the files dealing with sockets in thrift use "int" as the type of a 
> socket, as this is the idiomatic way to handle sockets on POSIX systems.  For 
> portability, a SOCKET typedef is probably needed.
> For the Pipe Server and Pipe Transport, HANDLEs are cast to ints to store as 
> member variables for some reason (maybe to avoid #including <windows.h> in a 
> header?).
> Both of these situations can result in invalid handles being used (and valid 
> handles being leaked) when the system is under load.

--
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