[ 
https://issues.apache.org/jira/browse/THRIFT-1690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavlin Radoslavov reopened THRIFT-1690:
---------------------------------------


The patch (Revision 1394182) broke the compilation for non-Linux UNIX
systems, because SOCKET is not defined. The compilation error below
is on FreeBSD-9.0:


/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. 
-I../..  -I/usr/local/include -I./src -I./src/thrift  -Wall -g -O2 -MT 
THttpClient.lo -MD -MP -MF .deps/THttpClient.Tpo -c -o THttpClient.lo `test -f 
'src/thrift/transport/THttpClient.cpp' || echo 
'./'`src/thrift/transport/THttpClient.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include -I./src 
-I./src/thrift -Wall -g -O2 -MT THttpClient.lo -MD -MP -MF 
.deps/THttpClient.Tpo -c src/thrift/transport/THttpClient.cpp  -fPIC -DPIC -o 
.libs/THttpClient.o
In file included from ./src/thrift/transport/TSocket.h:27,
                 from src/thrift/transport/THttpClient.cpp:25:
./src/thrift/transport/TServerSocket.h:64: error: 'SOCKET' has not been declared
./src/thrift/transport/TServerSocket.h:69: error: 'SOCKET' does not name a type
./src/thrift/transport/TServerSocket.h:79: error: 'SOCKET' does not name a type
./src/thrift/transport/TServerSocket.h:80: error: 'SOCKET' does not name a type
In file included from src/thrift/transport/THttpClient.cpp:25:
./src/thrift/transport/TSocket.h:203: error: 'SOCKET' does not name a type
./src/thrift/transport/TSocket.h:234: error: expected `)' before 'socket'
./src/thrift/transport/TSocket.h:265: error: 'SOCKET' does not name a type
gmake[4]: *** [THttpClient.lo] Error 1
gmake[4]: Leaving directory `/usr/home/pavlin/tmp/thrift/thrift-svn/lib/cpp'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory `/usr/home/pavlin/tmp/thrift/thrift-svn/lib/cpp'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/usr/home/pavlin/tmp/thrift/thrift-svn/lib'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/home/pavlin/tmp/thrift/thrift-svn'
gmake: *** [all] Error 2
Exit 2


The root cause is the following conditional definition inside file TSocket.h:


#ifdef __linux__
   typedef int SOCKET;
#endif


Obviously, this is not portable. The proper solution would be to check
for "SOCKET" inside configure.ac and conditionally typedef it for
all systems that don't have it.

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