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

Ben Craig commented on THRIFT-1870:
-----------------------------------

I have been on a Windows development hiatus for the last few months, so my 
local host communication has been able to go directly to TSocket.  At the time 
I made this change, I was able to get some basic cross platform usage out of 
(named) TPipe and the associated typedef.  They weren't particularly rigorous 
tests though.  0.9 was the first release for TPipe, so I wasn't breaking any 
client code by changing stuff from the old approach to the new approach, though 
I may have made things more difficult until they got fixed.

I had a different set of issues with TPipe on every platform.

Windows: TPipeServer doesn't conform very well to the TServerTransport 
interface.  Interrupt doesn't work (THRIFT-1777), and preServe events don't 
work right (THRIFT-1776).
OSX: Just passing in a string like "foo" as a pipename works poorly, because 
the pipe file is put in the current working directory.  If you put in a full 
path, you don't have portable code.  In addition, nothing in Thrift cleans up 
the pipe file, and there isn't a 100% safe way to do it.  Ideally, the last 
process to close the handle would clean up the file, but that isn't the case.
Linux: The same problems that OSX have are there for Linux as well, but on 
Linux, we can use abstract named pipes... except they don't work in Thrift.  
There's a ~4 line fix that I have in my local copy of Thrift that I haven't had 
the time to upstream.  Still, that fix requires passing in a std::string with 
the first character set to NULL, which isn't portable.

I don't recall having any compile time issues, but I also wasn't calling many 
different methods on TPipe / TSocket.  If there are some methods on TPipe or 
TSocket that make sense on the other class, then that seems like a reasonable 
portability improving change.

I haven't had any use cases for anonymous pipes, whether they be posix pipe 
based or Windows pipe based.  Their typical use case is to communicate between 
a parent process and a child process, or possibly between two sibling 
processes, and the code at my company rarely spawns child processes.  I'm glad 
to review patches for anonymous pipes (as I've reviewed this patch), but I 
doubt there will be a business case for me to do it personally.

                
> Enhance TPipe / TPipeServer transport to support both Windows 64-bit and 
> cross-platform *NIX support
> ----------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1870
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1870
>             Project: Thrift
>          Issue Type: Improvement
>    Affects Versions: 0.9
>         Environment: Windows, *NIX
>            Reporter: Peace C
>             Fix For: 0.9
>
>         Attachments: TPipe_64bit_xplatform.patch
>
>
> This patch adds support for Windows 64-bit builds by using std::ptrdiff_t to 
> represent Windows' pipe HANDLE. It also restores cross-platform *NIX support 
> that was broken in THRIFT-1690.
> See contrib/transport-sample for a working cross-platform example of how to 
> use TPipe[Server]. I tested all permutations of Win32/64-bit clients with 
> Win32/64-bit servers and they were happy. Also tested successfully on OSX.

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