[ https://issues.apache.org/jira/browse/THRIFT-2525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13997735#comment-13997735 ]
Peace C commented on THRIFT-2525: --------------------------------- Ben: I'll need to undo the reverts and re-build. Will get back to you on the values of h & overlap. I've observed that the C# client causes the server's createContext() & deleteContext() in TServerEventHandler to be called immediately upon client connection. Here's the sequence: (server running) (client calls Open) (server side callbacks...) createContext() deleteContext() createContext() It almost looks as though the C# client tests the connection first and immediately disconnects, then connects again for the "real" connection. From inspecting the code, this doesn't appear to be done purposefully. It may be an inherent behavior of .NET's NamedPipeClientStream. For instance, there's a bug with its Connect() method fast-spinning if the named pipe doesn't exist. Roger: I tested the reverted pipe transport with transport-sample and it passed. transport-sample does need some modifications due to tweaks in the pipe transport behavior since I first released it. I'm not authorized to post patches, but I'll describe what needs to be done --- In ThriftCommon.h line 189, the casts of RdPipe and WrtPIpe should be removed. Also if building on VS 2012 or later, remove USE_BOOST_THREAD at the top since the Thrift library is built using std::thread. In ThriftCommon.cpp, the body of LaunchAnonPipeChild() can be commented out. Anonymous pipes aren't implemented yet. [For VS2012 & newer] In server.cpp & client.cpp, replace boost::thread with std::thread. Call detach() immediately after starting the thread otherwise std::thread aborts when it goes out of scope. > C# client connecting to C++ server via named pipe transport gets > TTransportException > ------------------------------------------------------------------------------------ > > Key: THRIFT-2525 > URL: https://issues.apache.org/jira/browse/THRIFT-2525 > Project: Thrift > Issue Type: Bug > Components: C# - Library, C++ - Library > Affects Versions: 0.9.1 > Environment: Windows > Reporter: Peace C > Fix For: 0.9.2 > > > A C# client using TNamedPipeClientTransport, connecting to a C++ server using > TPipeServer, causes the following exception as reported by the debugger: > ------------------------------------------------------------------------------ > First-chance exception at 0x7703C41F in MyApp.exe: Microsoft C++ exception: > apache::thrift::transport::TTransportException at memory location 0x00D0EF80. > First-chance exception at 0x7703C41F in MyApp.exe: Microsoft C++ exception: > apache::thrift::transport::TTransportException at memory location 0x00D0EF80. > First-chance exception at 0x779C12F7 in MyApp.exe: 0xC0000008: An invalid > handle was specified. > ------------------------------------------------------------------------------ > Call Stack: > ------------------------------------------------------------------------------ > ntdll.dll!77b6f9d2() Unknown > [Frames below may be incorrect and/or missing, no symbols loaded for > ntdll.dll] > [External Code] > MyApp.exe!apache::thrift::TAutoHandle::~TAutoHandle() Line 83 C++ > [External Code] > > > > MyApp.exe!apache::thrift::transport::TWaitableNamedPipeImpl::beginAsyncRead(unsigned > > char * buf, unsigned int len) Line 149 C++ > > MyApp.exe!apache::thrift::transport::TWaitableNamedPipeImpl::TWaitableNamedPipeImpl(void > * pipehandle) Line 108 C++ > MyApp.exe!apache::thrift::transport::TPipe::TPipe(void * Pipe) Line 239 > C++ > MyApp.exe!apache::thrift::transport::TNamedPipeServer::acceptImpl() > Line 307 C++ > MyApp.exe!apache::thrift::transport::TPipeServer::acceptImpl() Line 215 > C++ > MyApp.exe!apache::thrift::transport::TServerTransport::accept() Line 57 > C++ > MyApp.exe!apache::thrift::server::TThreadedServer::serve() Line 159 > C++ > MyApp.exe!thriftServerFunc() Line 87 C++ > MyApp.exe!boost::detail::thread_data<void (__cdecl*)(void)>::run() Line > 117 C++ > MyApp.exe!boost::`anonymous namespace'::thread_start_function(void * > param) Line 217 C++ > [External Code] > ------------------------------------------------------------------------------ > The exception is thrown in TPipe.cpp, with readOverlap_.success = FALSE and > readOverlap_.last_error = 6 (ERROR_INVALID_HANDLE). > ------------------------------------------------------------------------------ > void TWaitableNamedPipeImpl::beginAsyncRead(uint8_t* buf, uint32_t len) > { > begin_unread_idx_ = end_unread_idx_ = 0; > readOverlap_.reset(buf, len, ready_event_.h); > thread_->addWorkItem(&readOverlap_); > if(readOverlap_.success == FALSE && readOverlap_.last_error != > ERROR_IO_PENDING) > { > GlobalOutput.perror("TPipe ::ReadFile errored GLE=", > readOverlap_.last_error); > throw TTransportException(TTransportException::UNKNOWN, "TPipe: ReadFile > failed"); > } > } > ------------------------------------------------------------------------------ -- This message was sent by Atlassian JIRA (v6.2#6252)