It's not expected behavior. It is highly unlikely to be related to the
generated code
(TSocket is not generated). I assume the TServerSocket code is doing something
to make
FreeBSD think it only wants IPv6. I'm not sure what the fix is, though.
--David
Aaron Bernard wrote:
> I coded up a test program in Thrift with a python client and server.
>
> When the server is on my Mac OSX machine and the client is on FreeBSD,
> everything works as expected. I can see the server side print statements and
> the return data on the client.
>
> However, if I try to serve from the FreeBSD machine, the client cannot
> connect with the following error:
>
> -----------------
> python test_client.py
> /usr/lib/python2.6/site-packages/thrift/Thrift.py:58: DeprecationWarning:
> BaseException.message has been deprecated as of Python 2.6
> self.message = message
> test_client.py:32: DeprecationWarning: BaseException.message has been
> deprecated as of Python 2.6
> print '%s' % (tx.message)
> Could not connect to 192.168.50.79:9090
> -----------------
>
> The server code is almost identical to the tutorial PythonServer.py code,
> with the TServerSocket registered on port 9090 as well. The code is
> identical on both machines, with the exception of swapped IPs in the TSocket
> call:
>
> test_client.py:
> -----------------
> ... imports, sys.path, etc. .....
>
> try:
> transport = TSocket.TSocket('192.168.50.79', 9090) # this IP is switched on
> the other machine
> transport = TTransport.TBufferedTransport(transport)
> protocol = TBinaryProtocol.TBinaryProtocol(transport)
> client = Test.Client(protocol)
> transport.open()
>
> client.ping()
> print 'ping()'
>
> val = client.number(5)
> print 'number back: %d' % (val)
>
> transport.close()
>
> except Thrift.TException, tx:
> print '%s' % (tx.message)
> -----------------
>
> I ran a FreeBSD `sockstat -4 -l' to confirm that the socket was running under
> the right port (or at all), but saw nothing. When I removed the -4 flag to
> see all sockets, not just IPv4, the service showed up.
>
> When I run `netstat -an' on the FreeBSD machine, here is the relevant output:
>
> netstat -an | grep 9090
> -----------------
> tcp6 0 0 *.9090 *.* LISTEN
>
> -----------------
>
> As you can see, the server is running tcp6 sockets on the 9090 python server.
>
> However, when I run this command on my Mac OSX machine, I get the following:
>
> netstat -an | grep 9090
> -----------------
> tcp46 0 0 *.9090 *.* LISTEN
> -----------------
>
> The Mac OSX is flexibly serving sockets on both IPv4 and IPv6.
>
> I have no firewall running on the FreeBSD machine. As bi-directional
> communication works just fine when the server roles are reversed, I don't
> think it has anything to do with that.
>
> So, my question is: is this expected behavior? Am I doing something wrong?
> Or is this perhaps a platform bug involving the generated python TSocket code
> and FreeBSD? Is this even relevant?
>
> Any help would be much appreciated.
>
> Thanks,
> Aaron