TCP proxy dies
There are some circumstances where the client or the server can kill the tcp proxy.
When a client stresses the socket and closes it, there is a high probability that the proxy dies due to what seems to be a bug in the tcp-proxy code.
Reproduce:
- run the server
$ ncat -l 16000 -k -c 'xargs -n2 echo'
- run the proxy on the same PC (you need to modify it so it prints the port where it is):
$ python -m bliss.comm.tcp_proxy --port=16000
Ready to accept requests on bcu01ctrl:34345
- run the client in attachment and press Ctrl-C at any time:
$ ./client-stress -p 34345 localhost
You should see on the proxy console something like this:
$ python -m bliss.comm.tcp_proxy --port=16000
Ready to accept requests on bcu01ctrl:34345
Traceback (most recent call last):
File "/home/coutinho/miniconda2/envs/bliss/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/home/coutinho/miniconda2/envs/bliss/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/coutinho/workspace/ESRF/git/Bliss/bliss/bliss/comm/tcp_proxy.py", line 238, in <module>
main()
File "/home/coutinho/workspace/ESRF/git/Bliss/bliss/bliss/comm/tcp_proxy.py", line 221, in main
client.sendall(raw_data)
AttributeError: 'NoneType' object has no attribute 'sendall'
Edited by Jose Tiago Macara Coutinho